Last active
August 29, 2015 14:26
-
-
Save chelnak/f6ebaaec479b68c5f7b8 to your computer and use it in GitHub Desktop.
Migrate vRealize Machine Prefixes with PowerShell
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
| #full path to cloudclient | |
| $cloudClientPath = "D:\cloudclient\bin\cloudclient.bat" | |
| #Path to your prefix json file | |
| $prefixJsonFile = "vra-machineprefixes.json" | |
| #Path to the resulting script file | |
| $prefixScriptFile = "machineprefix-cloudclient-commands.ps1" | |
| $machinePrefixes = Get-Content -Raw -Path "$($prefixJsonFile)" | ConvertFrom-Json | |
| $outFile = @() | |
| foreach ($item in $machinePrefixes.Items){ | |
| $outFile += "Invoke-Expression -Command '$cloudClientPath vra machineprefix add --prefix $($item.Prefix) --nextNumber $($item.NextNumber) --numberOfDigits $($item.NumberOfDigits)'" | |
| } | |
| $outFile | Set-Content -Path "$($prefixScriptFile)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment