Skip to content

Instantly share code, notes, and snippets.

@georgegoh
Created May 23, 2012 09:02
Show Gist options
  • Save georgegoh/2774042 to your computer and use it in GitHub Desktop.
Save georgegoh/2774042 to your computer and use it in GitHub Desktop.
#Retrieve a Userdata file.
function GetUserDataFile($DestinationPath)
{
$WebClient = (New-Object Net.WebClient)
$WebClient.DownloadFile("http://169.254.169.254/latest/user-data/", $DestinationPath)
}
$workingDir = "C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup"
#Get the userdata file into the working directory.
$userDataFileName = $workingDir + "\init.ps1"
GetUserDataFile $userDataFileName
cd $workingDir
.\init.ps1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment