Function Invoke-Quiet($ComputerName){ $QuietPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control" $CommandStatus = $false if(!(Test-Connection -ComputerName $ComputerName -Count 1)) { Write-Host "Exiting quiet...No connection made to [$ComputerName]" -ForegroundColor Red break } else { $CommandStatus = Invoke-Command -ComputerName $ComputerName -SessionOption (New-PSSessionOption -NoMachineProfile) -ScriptBlock { if(Test-Path $Using:QuietPath) { Set-ItemProperty -Path $Using:QuietPath -Name "RemCtrl Connection Bar" -Value 0 Set-ItemProperty -Path $Using:QuietPath -Name "RemCtrl Taskbar Icon" -Value 0 Return $true } else { Return $false } Return $false } if($CommandStatus) { Write-Host "Executed quiet override successfully on [$ComputerName] `nPath: $QuietPath" -ForegroundColor Green } else { Write-Host "Failed quiet override on [$ComputerName]`nPath: $QuietPath`nCheck [$ComputerName] is running Powershell V3.0 or above.`nCheck that registry exists." -ForegroundColor Red } } Remove-PSSession $ComputerName }