Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requierement might be to set the following settings via GPO :
- #Never attempt to download payload from Windows Update => Disabled
- #Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS) => Enabled
- If ((Get-WindowsOptionalFeature -Online -FeatureName NetFX3).State -eq "Enabled")
- {
- #Install OpenSSH
- Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
- #Start and configure the service
- Start-Service sshd
- Set-Service -Name sshd -StartupType 'Automatic'
- New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
- }
- Else
- {
- #Install FrameWork 3.5
- Dism /online /enable-feature /featurename:NetFX3 /All /Source:\\share\stuff\FrameWork-3.5\dotnetfx35.exe
- $RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce"
- $ScriptPath = $MyInvocation.MyCommand.Definition
- $ScriptExecPath = "C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -File "
- $ScriptFullExecPath = $ScriptExecPath + $ScriptPath
- Set-ItemProperty $RunOnceKey "NextRun" $ScriptFullExecPath
- Restart-Computer
- }
- #To connect via a SSH client : ssh AD\username@servername
Add Comment
Please, Sign In to add comment