Skip to content

Instantly share code, notes, and snippets.

@jmahlman
Created April 20, 2016 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmahlman/68127c295010a8d1b514c1ca34231e02 to your computer and use it in GitHub Desktop.
Save jmahlman/68127c295010a8d1b514c1ca34231e02 to your computer and use it in GitHub Desktop.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit
}
$hostMac = Get-Content \\Mac\Home\Public\hostname
$newName = "vm-$hostMac"
echo "Renaming Compter to $newName"
Rename-Computer -NewName $newName
echo "Setting up UArts-User account to auto-login with no password."
cmd.exe /c 'C:\Users\Public\autoLogin.bat'
echo "RESTARTING VIRTUAL MACHINE NOW!!!!!!!!"
sleep 1
echo "The answer is 42"
Restart-Computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment