Powershell script to stop-website on a remote computer
$securepassword=Convertto-SecureString –String $(adminpassword) –AsPlainText –force
$mycredentials=New-object System.Management.Automation.PSCredential $(adminuser),$securepassword
Invoke-Command -ComputerName "computername" -ScriptBlock {
Import-module WebAdministration;
Stop-Website "TestCD"
} -Credential $mycredentials
$securepassword=Convertto-SecureString –String $(adminpassword) –AsPlainText –force
$mycredentials=New-object System.Management.Automation.PSCredential $(adminuser),$securepassword
Invoke-Command -ComputerName "computername" -ScriptBlock {
Import-module WebAdministration;
Stop-Website "TestCD"
} -Credential $mycredentials
No comments:
Post a Comment