I would like to run the following script from my workstation and have it execute on the remote IIS web server by providing the IP address of the web server.
My code looks something like this and returns the name of a site and the state.
$iis = (New-Object Microsoft.Web.Administration.ServerManager).Sites
[string] $OutFile = "C:\WebState.txt"
[string] $host2 = [System.Net.Dns]::GetHostName()
foreach($MySite in $iis)
$MySite.Name + ":" + $MySite.State | Out-File $OutFile -append
How do I run this script local and have it execute on my remote web server?