Created
March 24, 2020 14:15
-
-
Save sammcgeown/ff1d43559b3dce8d721adee3930d6925 to your computer and use it in GitHub Desktop.
PowerShell ABX Rename Machine
This file contains 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
function handler($context, $payload) { | |
$oldVMName = $payload.resourceNames[0] | |
$newVMName = $payload.customProperties.userDefinedName | |
$returnObj = [PSCustomObject]@{ | |
resourceNames = $payload.resourceNames | |
} | |
$returnObj.resourceNames[0] = $newVMName | |
Write-Host "Setting machine name from $($oldVMName) to $($newVMName)" | |
return $returnObj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment