newhk
BANNED | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Приветствую! Написал вот такой шедевр )) Код: # ????????? ???????? ????? ? ?????????? ???????? ????????? ??????? ??????? # ??????? ???? cls Write-Host Write-Host " ??? ??????????? ?????? ?????????" -ForegroundColor Magenta Write-Host Write-Host "1. ?????? ?????????" -ForegroundColor DarkYellow Write-Host "2. ????????? ????? ??????????, ???????? ??? ???????? ??????" -ForegroundColor DarkYellow Write-Host "3. ????????? ?????? ??????????" -ForegroundColor DarkYellow Write-Host "4. ???? ?????????? ? ?????" -ForegroundColor DarkYellow Write-Host "5. ?????????? ???????? ??? ?????????? ??????????????" -ForegroundColor DarkYellow Write-Host "6. ?????" -ForegroundColor Green Write-Host "7. ????????????" -ForegroundColor Cyan Write-Host "8. ?????????? ??????" -ForegroundColor Cyan Write-Host $choice = Read-Host "???????? ????????? ???????? ? ??????? ENTER" Switch($choice){ 1{$Alls} 2{$TRs} 3{$Anti} 4{$comp_entering_domain} 5{$loc_users} 6{Exit} 7{Restart-Computer} 8{Stop-Computer} default {Write-Host "???????????? ?????, ?????????? ??? ???" -ForegroundColor Red} } # 1 - ????? ?????????? Function Alls() { # # ??????? ??? ??? ??????? ? OneDrive $systeminfo = Get-CimInstance -ClassName Win32_OperatingSystem $sysinf = $systeminfo.Version $infsys = $sysinf[0..1] -join '' if ($infsys -eq 10){ Stop-Process -Name OneDrive -Force -ErrorAction 0 "$env:SystemRoot\System32\OneDriveSetup.exe","$env:SystemRoot\SysWOW64\OneDriveSetup.exe" | Foreach { if(Test-Path $_) { Start-Process $_ -ArgumentList "/uninstall" -Wait } } $dir = "$env:USERPROFILE\OneDrive","C:\OneDriveTemp\","$env:LOCALAPPDATA\Microsoft\OneDrive","$env:ProgramData\Microsoft OneDrive" $dir | Foreach { Remove-Item -LiteralPath $_ -Force -Recurse } } REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f REG DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /v "DisableFileSyncNGSC" /t REG_DWORD /d "1" /f # # ??????????? ??????????? ?? $OS = Get-WmiObject -Computer localhost -Class Win32_OperatingSystem $ostype = $OS.OSArchitecture # ?????? ?????????? ??? ????????? 7-Zip if ($typeos -eq "64-"){ $7zippath = "\\P59-files\soft\Auto_install\7-zip\x64" } else { $7zippath = "\\P59-files\soft\Auto_install\7-zip\x32" } echo '????????????? 7-Zip' if (!(Test-Path "$env:ProgramFiles\7-Zip")) {Start-Process -FilePath $7zippath\7z.exe-Args /S -Wait} # # ????? ?????????? ??? ????????? MS Office if ($typeos -eq "64-"){ $MSOpath = "\\P59-files\soft\Auto_install\MS-Office-2010\x32" } else { $MSOpath = "\\P59-files\soft\Auto_install\MS-Office-2010\x64" } echo '????????????? MS Office 2010' if (!(Test-Path "$env:ProgramFiles\Microsoft Office")) {Start-Process -FilePath $MSOpath\setup.exe -ArgumentList "/adminfile $MSOpath\MS-autosetup.MSP" -Wait} # # ?????? ?????????? ??? ????????? GoogleChrome if ($typeos -eq "64-"){ $CHROMEpath = "\\P59-files\soft\Auto_install\google\chrome\x32" } else { $CHROMEpath = "\\P59-files\soft\Auto_install\google\chrome\x64" } echo '????????????? Google Chrome' if (!(Test-Path "$env:ProgramFiles\Google\Chrome")) { Start-Process -Filepath "$CHROMEpath\GoogleChromeStandaloneEnterprise.msi" -ArgumentList '/quiet /passive' -Wait Start-Process -FilePath "$CHROMEpath\LegacyBrowserSupport_5.1.0.0_en.msi" -ArgumentList '/quiet /passive' -Wait } echo '????????????? Adobe Reader DC' if (!(Test-Path "c:\Program Files (x86)\Adobe")) {Start-Process -FilePath \\P59-files\soft\Auto_install\AcroRdrDC_ru_RU.exe -Args /sAll -Wait} echo '????????????? 1?' if (!(Test-Path "$env:ProgramFiles (x86)\1cv8")){Start-Process -FilePath "\\P59-files\soft\Auto_install\1C\1Cx32\1CEnterprise 8.msi" -ArgumentList '/quiet /norestart' -Wait} # # ????????????? ?????????? ??? ????????? 1? $OS = Get-WmiObject -Computer localhost -Class Win32_OperatingSystem $ostype = $OS.OSArchitecture if ($ostype -eq "64-"){ $typeos = "C:\program files\1cv8" } else { $typeos = "C:\program files (x86)\1cv8" } $fPath = Get-ChildItem -Path $typeos\ -Filter bin -Recurse -name echo '??????????' \\P59-files\soft\Auto_install\1C\UniPatch\1c8_uni3patch.exe "$typeos\$fPath\backbas.dll" echo '????????????? BullZIP PDF Printer' if (!(Test-Path "$env:ProgramFiles\Bullzip\")){Start-Process -FilePath \\P59-files\soft\Auto_install\BullzipPDF\Setup_BullzipPDFPrinter_11_8_0_2728_PRO_EXP.exe -Wait} echo "???????? ????????? ?????????? ??? ???????? 1?" if (!(Test-Path "$typeos\$fPath\1c_components")){ New-Item -Path "$typeos\$fPath\1c_components" -itemtype "Directory" -Force | Out-Null Get-ChildItem '\\P59-files\soft\Auto_install\1c_components' | Copy-Item -Destination C:\components -force } # ???? ????? ??????????, ?? ????????? ? ??? if (Test-Path "$typeos\$fPath\1c_components"){cd "$typeos\$fPath\1c_components"} & reg_1c_components.bat } $main_menu # 2 - ?????????? ??? ???????? ?????? Function TRs() { # # ??????? ??? ??? ??????? ? OneDrive $systeminfo = Get-CimInstance -ClassName Win32_OperatingSystem $sysinf = $systeminfo.Version $infsys = $sysinf[0..1] -join '' if ($infsys -eq 10){ Stop-Process -Name OneDrive -Force -ErrorAction 0 "$env:SystemRoot\System32\OneDriveSetup.exe","$env:SystemRoot\SysWOW64\OneDriveSetup.exe" | Foreach { if(Test-Path $_) { Start-Process $_ -ArgumentList "/uninstall" -Wait } } $dir = "$env:USERPROFILE\OneDrive","C:\OneDriveTemp\","$env:LOCALAPPDATA\Microsoft\OneDrive","$env:ProgramData\Microsoft OneDrive" $dir | Foreach { Remove-Item -LiteralPath $_ -Force -Recurse } } REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f REG DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f Reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /v "DisableFileSyncNGSC" /t REG_DWORD /d "1" /f # # ??????????? ??????????? ?? $OS = Get-WmiObject -Computer localhost -Class Win32_OperatingSystem $ostype = $OS.OSArchitecture # ?????? ?????????? ??? ????????? 7-Zip if ($typeos -eq "64-"){ $7zippath = "\\P59-files\soft\Auto_install\7-zip\x64" } else { $7zippath = "\\P59-files\soft\Auto_install\7-zip\x32" } echo '????????????? 7-Zip' if (!(Test-Path "$env:ProgramFiles\7-Zip")) {Start-Process -FilePath $7zippath\7z.exe-Args /S -Wait} # # ????? ?????????? ??? ????????? MS Office if ($typeos -eq "64-"){ $MSOpath = "\\P59-files\soft\Auto_install\MS-Office-2010\x32" } else { $MSOpath = "\\P59-files\soft\Auto_install\MS-Office-2010\x64" } echo '????????????? MS Office 2010' if (!(Test-Path "$env:ProgramFiles\Microsoft Office")) {Start-Process -FilePath $MSOpath\setup.exe -ArgumentList "/adminfile $MSOpath\MS-autosetup.MSP" -Wait} # # ?????? ?????????? ??? ????????? GoogleChrome if ($typeos -eq "64-"){ $CHROMEpath = "\\P59-files\soft\Auto_install\google\chrome\x32" } else { $CHROMEpath = "\\P59-files\soft\Auto_install\google\chrome\x64" } echo '????????????? Google Chrome' if (!(Test-Path "$env:ProgramFiles\Google\Chrome")) { Start-Process -Filepath "$CHROMEpath\GoogleChromeStandaloneEnterprise.msi" -ArgumentList '/quiet /passive' -Wait Start-Process -FilePath "$CHROMEpath\LegacyBrowserSupport_5.1.0.0_en.msi" -ArgumentList '/quiet /passive' -Wait } echo '????????????? Adobe Reader DC' if (!(Test-Path "c:\Program Files (x86)\Adobe")) {Start-Process -FilePath \\P59-files\soft\Auto_install\AcroRdrDC_ru_RU.exe -Args /sAll -Wait} } $main_menu # 3 - ????????????? ????????? Function Anti() { $Antivir = { # ?????? ?????????? $nPath = {\\minimaks.ru\NETLOGON\NOD 6.0} # ??????????? ??????????? ?? $OS = Get-WmiObject -Computer localhost -Class Win32_OperatingSystem $ostype = $OS.OSArchitecture # ?????? ?????????? ??? ??????????? ??????????? ???????????? ????? if ($typeos -eq "64-"){ $Agent = {Agent_x86.msi} } else { $Agent = {Agent_x64.msi} } # ?????? ?????????? ??? ??????? ? ??????? ???? $user = read-host "??????? ??? ????????????" # ??????? ?????? cls Write-Host Write-Host " ???? ????????? ?????? ?????????? NOD 32" -ForegroundColor Magenta -BackgroundColor White Write-Host Write-Host "1. ?????????" -ForegroundColor Green Write-Host "2. ????????????" -ForegroundColor DarkYellow Write-Host "3. ????????" -ForegroundColor Red Write-Host "4. ????????" -ForegroundColor White Write-Host "5. ??????? ? ??????? ????" -ForegroundColor Cyan Write-Host $choice = Read-Host "???????? ????????? ???????? ? ??????? ENTER" Switch($choice){ 1{Start-Process -Credential minimaks\$user -FilePath "$nPath\agentL260\$Agent" -wait} 2{Start-Process -Credential minimaks\$user -FilePath "$nPath\agentP59\$Agent" -wait} 3{Start-Process -Credential minimaks\$user -FilePath "$nPath\agenG16\$Agent" -wait} 4{Start-Process -Credential minimaks\$user -FilePath "$nPath\agentShops\$Agent" -wait} 5{$main_menu} default {Write-Host "???????????? ?????, ?????????? ??? ???" -ForegroundColor Red} } } } $main_menu # 4 - ?????? ???? ? ????? Function comp_entering_domain() { $compname = read-host '??????? ??? ??????????' Set-Variable -Name 1 -Value '???????? 16' Set-Variable -Name 2 -Value '?????????? 12' Set-Variable -Name 3 -Value '????????? 260' Set-Variable -Name 4 -Value '????????' Set-Variable -Name 5 -Value '????????????? 59' $choose = read-host ( "???????? ????? ??????????????? ??????????? ????????: 1 ???????? 16 2 ?????????? 12 3 ????????? 260 4 ???????? 5 ????????????? 59 ") $place=get-variable -Value $choose Add-Computer -NewName $compname -DomainName minimaks.ru -Credential minimaks.ru\p59_adm1 -OUPath "OU=$place,OU=??????????,OU=???????? ?????-?????????,DC=MINIMAKS,DC=RU" -PassThru -Verbose } $main_menu # 5 - ?????????? ???????? ??? ?????????? ?????????????? Function loc_users() { $UserPassword = ConvertTo-SecureString "bgfngn!" -AsPlainText -Force New-LocalUser 'LocalAdminMM' -Password $UserPassword -FullName "????????? ?????????????" -Description "????????? ?????????????" Set-LocalUser -Name 'LocalAdminMM' -PasswordNeverExpires $True Get-Localuser -Name 'LocalAdminMM' | Add-LocalGroupMember -Group 'Administrators' Get-Localuser -Name 'LocalAdminMM' | Add-LocalGroupMember -Group '??????????????' Set-LocalUser -Name '?????????????' -PasswordNeverExpires $True Set-LocalUser -Name ????????????? -AccountNeverExpires -Password $UserPassword -PasswordNeverExpires $True Set-LocalUser -Name LocalAdminMM -AccountNeverExpires -Password $UserPassword -PasswordNeverExpires $True Enable-LocalUser -Name '?????????????' Disable-LocalUser -Name '????' Disable-LocalUser -Name '1' Disable-LocalUser -Name '111' Disable-LocalUser -Name '123' } # 6 - ????? # 7 - ???????????? | Кодировка съехала, а ну и пусть )) К вопросу это не имеет отношения. Собственно сам вопрос: Сделал меню выбора. Выбираю, например, вариант 1, все устанавливается, но вконце, после завершения установки, скрипт завершает работу. Как мне после выполнения данного варианта вернуться в начало к МЕНЮ? |