We can use Windows PowerShell remoting features to manage IIS 7 websites remotely. Currently, remoting is supported on Windows Vista with Service Pack 1 or later, Windows 7, Windows Server 2008, and Windows Server 2008 Release 2.
- Start Windows PowerShell as an administrator by right-clicking the Windows PowerShell shortcut and selecting Run As Administrator.
- Enable PowerShell Remoting with Enable-PSRemoting -Force
- Starting a Remote Session using: Enter-PSSession -ComputerName <COMPUTER> -Credential <USER>
Now the PowerShell connected to the remote server. Any commands issued with work against the remote server. We can use the Appcmd.exe command line tool to manage remote server just as what we do locally.
For example, to add an application pool:
c:\windows\system32\inetsrv\appcmd add apppool /name:"Contoso" /managedPipelineMode:Integrated /managedRuntimeVersion:"v4.0" /enable32BitAppOnWin64:true
To change application pool for an application:
c:\windows\system32\inetsrv\appcmd set app /app.name:ContosoSite/Administration /applicationPool:Contoso
Comments