Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remote creation of IIS websites.
$username = "insert_username_here"
$password = ConvertTo-SecureString "insert_password_here" -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$password
$session = New-PSSession "insert_hostname_here" -Credential $credential
Invoke-Command -Session $session -ScriptBlock {
Set-ExecutionPolicy RemoteSigned
Import-Module WebAdministration
New-Item iis:\Sites\ -bindings @{protocol="http";bindingInformation=""} -physicalPath c:\inetpub\wwwroot\
Set-ItemProperty 'IIS:\Sites\' ApplicationPool "ASP.NET v4.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment