Created
January 1, 2013 06:31
-
-
Save SyntaxC4/4425565 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$DecryptionToken, [string]$DecryptionKey, [string]$ValidationToken, [string]$ValidationKey) | |
Import-Module WebAdministration | |
Foreach ($site in Get-Website IIS:\Sites) { | |
$curSite = $site.Name.ToString() | |
Set-WebConfigurationProperty /system.web/machinekey -PSPath "IIS:\Sites\$curSite" -Name Decryption -Value $DecryptionToken | |
Set-WebConfigurationProperty /system.web/machinekey -PSPath "IIS:\Sites\$curSite" -Name DecryptionKey -Value $DecryptionKey | |
Set-WebConfigurationProperty /system.web/machinekey -PSPath "IIS:\Sites\$curSite" -Name Validation -Value $ValidationToken | |
Set-WebConfigurationProperty /system.web/machinekey -PSPath "IIS:\Sites\$curSite" -Name ValidationKey -Value $ValidationKey | |
} | |
Remove-Module WebAdministration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Powershell.exe -ExecutionPolicy RemoteSigned -Command ".\ChangeMachineKey.ps1" 'AES' 'BC69E927D76C3B2C8BA96683AEE46324FC94C4760596238B5BB444E04F5C643C' 'SHA1' '81CB49C2CC63FC38B93A19010953E91F605B67103101CBE64A9B81386137556E3DADA60D2AD2DE61EDA2B0071C84E4904722EA0BB79A7750DCBB79A860C66E60' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> | |
<WebRole name="WebRole1"> | |
<Startup> | |
<Task commandLine="PowershellRun.cmd" executionContext="elevated" taskType="background" /> | |
</Startup> | |
</WebRole> | |
</ServiceDefinition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment