20 lines
970 B
PowerShell
20 lines
970 B
PowerShell
$import = import-csv D:\VMsToFix.csv #| where-object Name -eq itdvmvc1script.nd.gov
|
|
|
|
Get-VM ($import).Name | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } | Stop-VMGuest -Confirm:$false
|
|
|
|
ForEach($VM in $import){
|
|
Get-VM $VM.Name | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } | Stop-VMGuest -Confirm:$false
|
|
}
|
|
|
|
# status check
|
|
Get-VM -Name ($import).Name | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } | group-object PowerState
|
|
|
|
|
|
# report
|
|
Get-VM -Name ($import).Name | Select Name,PowerState,NumCpu,CoresPerSocket -ov BeforeChange
|
|
$BeforeChange | Export-Csv "D:\BeforeChange.csv"
|
|
|
|
Get-VM -Name ($import).Name | Set-VM -CoresPerSocket 1 -Confirm:$false
|
|
|
|
Get-VM -Name ($import).Name | Select Name,PowerState,NumCpu,CoresPerSocket
|
|
#Get-VM -Name ($import).Name | Where-Object { $_.ExtensionData.summary.config.ManagedBy.Type -ne "placeholderVm" } | Start-VM |