properly redirect sc.exe stderr to $null (#187)
Signed-off-by: Rui Lopes <rgl@ruilopes.com>
This commit is contained in:
parent
bb9e5b27f2
commit
da48ae4da0
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue