Powershell to enable PSremoting and execution policy
Now a day PS remoting has more importance since we can not go to each and every server to execute powershell commands and get the results. Powershell have lot of remoting options like most of the command have -computername parameter which we can use to specify remote target server or we can use invoke-command. nbut before you execute powershell script remotely you should have PSremoting enable on target server.
executing below powershell script allow you to do PS remoting
# Configures the server for WinRM
Write-Host “Configuring PowerShell remoting…”
$winRM = Get-Service -Name winrm
If ($winRM.Status -ne “Running”)
{Start-Service -Name winrm}
Set-ExecutionPolicy Bypass -Force
Enable-PSRemoting -Force
(Visited 3 times, 1 visits today)