Created
March 31, 2016 14:03
-
-
Save gregjhogan/f0b00731c37ab7578c85e906786b5157 to your computer and use it in GitHub Desktop.
How to run a script as a different user in an Azure VM Custom Script Extension
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
Enable-PSRemoting -Force | |
$credential = New-Object System.Management.Automation.PSCredential @(($AdminDomain + "\" + $AdminUsername), (ConvertTo-SecureString -String $AdminPassword -AsPlainText -Force)) | |
Invoke-Command -FilePath $PSScriptRoot\setup-as-user.ps1 -Credential $credential -ComputerName localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment