properly redirect sc.exe stderr to $null (#187)

Signed-off-by: Rui Lopes <rgl@ruilopes.com>
This commit is contained in:
Rui Lopes 2017-07-28 23:36:01 +01:00 committed by Manoj Ampalam
parent bb9e5b27f2
commit da48ae4da0
2 changed files with 4 additions and 7 deletions

View File

@ -255,13 +255,13 @@ if (-not (Test-Path $sshdpath)) {
if (Get-Service sshd -ErrorAction SilentlyContinue)
{
Stop-Service sshd
sc.exe delete sshd 1> null
sc.exe delete sshd 1>$null
}
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
{
Stop-Service ssh-agent
sc.exe delete ssh-agent 1> null
sc.exe delete ssh-agent 1>$null
}
New-Service -Name ssh-agent -BinaryPathName $sshagentpath -Description "SSH Agent" -StartupType Manual | Out-Null

View File

@ -1,7 +1,7 @@
if (Get-Service sshd -ErrorAction SilentlyContinue)
{
Stop-Service sshd
sc.exe delete sshd 1> null
sc.exe delete sshd 1>$null
Write-Host -ForegroundColor Green "sshd successfully uninstalled"
}
else {
@ -11,12 +11,9 @@ else {
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
{
Stop-Service ssh-agent
sc.exe delete ssh-agent 1>null
sc.exe delete ssh-agent 1>$null
Write-Host -ForegroundColor Green "ssh-agent successfully uninstalled"
}
else {
Write-Host -ForegroundColor Yellow "ssh-agent service is not installed"
}