File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 44 # Microsoft privided OpenSSH must be installed on Windows 2019
55 # => https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell&pivots=windows-server-2019
66 $sshPackages = @ (" OpenSSH.Client" , " OpenSSH.Server" )
7- foreach ($sshPackage in $sshPackages )
8- {
9- Get-WindowsCapability - Online - Name " $sshPackage *" `
10- | Where-Object { $_.State -eq " NotPresent" } `
11- | Add-WindowsCapability - Online
7+ foreach ($sshPackage in $sshPackages ) {
8+ try {
9+ $moduleName = (Get-WindowsCapability - Online - Name " $sshPackage *" | ForEach-Object Name)
10+ Add-WindowsCapability - Online - Name $moduleName
11+ } catch {
12+ Write-Output " Error installing $moduleName : $_ "
13+ }
1214 }
1315 }
1416
You can’t perform that action at this time.
0 commit comments