COS's Posts

Lab Environment to do proof of concept: HPE DL380 Gen8 Windows 2016 server VMware Workstation 17 Trial   VAMI keeps coming up "Unable to get deployment status.", UI seems to wok though. I go ... See more...
Lab Environment to do proof of concept: HPE DL380 Gen8 Windows 2016 server VMware Workstation 17 Trial   VAMI keeps coming up "Unable to get deployment status.", UI seems to wok though. I go to https://10.9.8.26:5480 then it redirects me to https://10.9.8.26:5480/configurev2/#/ and prompts for creds. I authenticate and it comes up with "Unable to get deployment status." At the console there is a message that says "Failed to start services. Firstboot Error." I have tried steps in this thread but no luck: https://communities.vmware.com/t5/VMware-vCenter-Discussions/Can-t-access-VAMI-quot-Unable-to-get-deployment-status-quot/td-p/2923026 I have already redeployed 6 times to VMware Worstation.   Also, "A" record and "PTR" exists. NSLOOKUP seems fine... Update: 7/9/2023 8:13PM Blew out the vcenter7 again and redeployed fresh (again) and I am still getting the message "Unable to get deployment status."!!! Thanks
So I removed "| Get-Folder -Name Datacenters" and the error is different but I only get it once then lists my VM's.... Get-Folder : Cannot validate argument on parameter 'Name'. The argument is null... See more...
So I removed "| Get-Folder -Name Datacenters" and the error is different but I only get it once then lists my VM's.... Get-Folder : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:8 char:31 + $foder = Get-Folder -Name $_ -Location $folder + ~~ + CategoryInfo : InvalidData: (:) [Get-Folder], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetFolder   Full code... Connect-VIServer "vc1.mystuff.net" #-AllLinked $folderPath = 'vcenter1\test\dudesvms' $folderPath.Split('\') ForEach-Object -Process { $foder = Get-Folder -Name $_ -Location $folder } Get-VM -Location $folder | Select Name,@{N='CreationDate';E={$_.ExtensionData.Config.createDate}} | Sort-Object -Property CreationDate #-Descending DisConnect-VIServer "vc1.mystuff.net" -Confirm:$False  
How do I order by date? Answered my question..... Sort-Object -Property CreationDate
I get a few of these errors then the list of VM's come up..... Get-Folder : 6/15/2021 3:56:28 PM Get-Folder Get-Folder does not accept string input through pipeline. The string 'vcenter1' was ignore... See more...
I get a few of these errors then the list of VM's come up..... Get-Folder : 6/15/2021 3:56:28 PM Get-Folder Get-Folder does not accept string input through pipeline. The string 'vcenter1' was ignored. At line:6 char:26 + $folderPath.Split('\') | Get-Folder -Name Datacenters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (vcenter1:String) [Get-Folder], ObnRecordProcessingFailedException + FullyQualifiedErrorId : Core_ObnArgumentTransformationAttribute_ProcessStringElement_InvalidPipelineArgument,VMware.VimAutomation.ViCor e.Cmdlets.Commands.GetFolder   Possible difference in versions? My version.... PowerCLI Version ---------------- VMware PowerCLI 11.0.0 build 10380590 --------------- Component Versions --------------- VMware Cis Core PowerCLI Component PowerCLI Component 11.0 build 10335701 VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.0 build 10336080  
I can get an individual VM's create date.... (Get-VM -Name testvm1).ExtensionData.Config.createDate How do I get a list of VM's created in the past 10 days that are in my folder and subfolders in "... See more...
I can get an individual VM's create date.... (Get-VM -Name testvm1).ExtensionData.Config.createDate How do I get a list of VM's created in the past 10 days that are in my folder and subfolders in "vcenter1\test\dudesvms\"? Thanks  
Figured it out. I'm an idiot, I was pointing to the vCenter server with less VM's. It all works. Thanks!
OK, that got it explicitly to the folder. and returns the VM in the root of that folder. How can I get it to return a list of other VM's in folders within that folder?
I have the below script segment that looks into a specific folder called "csd" on the specific vCenter server.... Connect-VIServer ''myvcente01'' #-Alllinked $folderName = 'csd' $result = ... See more...
I have the below script segment that looks into a specific folder called "csd" on the specific vCenter server.... Connect-VIServer ''myvcente01'' #-Alllinked $folderName = 'csd' $result = @() $folder = Get-View -ViewType Folder -Filter @{Name=$folderName} -Server ''myvcente01'' $vms = Get-view  -ViewType VirtualMachine -SearchRoot $folder.MoRef foreach ($vm in $vms) {     if($vm.config.hardware.NumCoresPerSocket -ne $null){         $cores = $vm.config.hardware.NumCoresPerSocket     }     else{         $cores = 1     }     $obj = new-object psobject     $obj | Add-Member -MemberType NoteProperty -Name ServerName -Value ($vm.Name)     $obj | Add-Member -MemberType NoteProperty -Name CPUs -Value ($vm.config.hardware.NumCPU)     $obj | Add-Member -MemberType NoteProperty -Name Sockets -Value ($vm.config.hardware.NumCPU/$cores)     $obj | Add-Member -MemberType NoteProperty -Name CPUPersocket -Value $cores     $obj | Add-Member -MemberType NoteProperty -Name RAMAssigned -Value ([math]::Round($vm.Config.Hardware.MemoryMB/1KB))     $obj | Add-Member -MemberType NoteProperty -Name OSProfile -Value $vm.Config.GuestFullName     $result += $obj } $result | Export-Csv -Path c:\temp\cputest_ddc_csd.txt -NoTypeInformation DisConnect-VIServer 'myvcente01' I am getting the below error... Get-View : Cannot convert 'System.Object[]' to the type 'VMware.Vim.ManagedObjectReference' required by parameter 'SearchRoot'. Specified method is not supported. At C:\Temp\Get-VM-CPU-Cores-OSProfile-vCenterAffinity.ddc-csd.ps1:6 char:55 + $vms = Get-view  -ViewType VirtualMachine -SearchRoot $folder.MoRef +                                                       ~~~~~~~~~~~~~     + CategoryInfo          : InvalidArgument: (:) [Get-View], ParameterBindingException     + FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView I confirmed the folder does not have duplicate names anywhere on 'myvcente01'. Withing that folder "csd" there a other subfolders with VM's. Not sure if that means anything though. I would like those VM's in subfolders included in the output.
Correct, there are 2 datacenters and each has a department called Disneyland vcenters are in linked mode. I removed the -AllLinked and still get the error. Any ideas on how to connect to only one... See more...
Correct, there are 2 datacenters and each has a department called Disneyland vcenters are in linked mode. I removed the -AllLinked and still get the error. Any ideas on how to connect to only one of the vcenter servers?
I got this error..... Get-View : Cannot convert 'System.Object[]' to the type 'VMware.Vim.ManagedObjectReference' required by parameter 'SearchRoot'. Specified method is not supported. At l... See more...
I got this error..... Get-View : Cannot convert 'System.Object[]' to the type 'VMware.Vim.ManagedObjectReference' required by parameter 'SearchRoot'. Specified method is not supported. At line:11 char:55 + $vms = Get-view  -ViewType VirtualMachine -SearchRoot $folder.MoRef +                                                       ~~~~~~~~~~~~~     + CategoryInfo          : InvalidArgument: (:) [Get-View], ParameterBindingException     + FullyQualifiedErrorId : CannotConvertArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView and returns every VM in the vcenter.
I have the below script that get's me data... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) {     if($vm.config.hardware.NumCoresPerSocket -ne $null){  ... See more...
I have the below script that get's me data... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) {     if($vm.config.hardware.NumCoresPerSocket -ne $null){         $cores = $vm.config.hardware.NumCoresPerSocket     }     else{         $cores = 1     }     $obj = new-object psobject     $obj | Add-Member -MemberType NoteProperty -Name ServerName -Value ($vm.Name)     $obj | Add-Member -MemberType NoteProperty -Name CPUs -Value ($vm.config.hardware.NumCPU)     $obj | Add-Member -MemberType NoteProperty -Name Sockets -Value ($vm.config.hardware.NumCPU/$cores)     $obj | Add-Member -MemberType NoteProperty -Name CPUPersocket -Value $cores     $obj | Add-Member -MemberType NoteProperty -Name RAMAssigned -Value ([math]::Round($vm.Config.Hardware.MemoryMB/1KB))     $obj | Add-Member -MemberType NoteProperty -Name OSProfile -Value $vm.Config.GuestFullName     $result += $obj } #$result | Out-File c:\temp\cputest.txt $result | Export-Csv -Path c:\temp\cputest.txt -NoTypeInformation It works and gets me data for every VM. Below is a sample.... "ServerName","CPUs","Sockets","CPUPersocket","RAMAssigned","OSProfile" "goofy","2","2","1","6","Microsoft Windows Server 2012 (64-bit)" "pluto","3","3","1","12","Microsoft Windows Server 2012 (64-bit)" "donaldduck","4","2","2","16","Microsoft Windows Server 2012 (64-bit)" How can I point it to a specific VM folder called "Disneyland"?
Dude, I would have never guessed the "$vm.Config.GuestFullName" calls for the Operating System type for the VM..........lmao. Thanks again!
OK, thanks! The values returned correctly...... ServerName   : goofy CPUs         : 2 Sockets      : 2 CPUPersocket : 1 RAMAssigned  : 6 ServerName   : pluto CPUs         : 4 Socke... See more...
OK, thanks! The values returned correctly...... ServerName   : goofy CPUs         : 2 Sockets      : 2 CPUPersocket : 1 RAMAssigned  : 6 ServerName   : pluto CPUs         : 4 Sockets      : 4 CPUPersocket : 1 RAMAssigned  : 8 Changed my output to below for a CSV.... $result | Export-Csv -Path c:\temp\cputest.txt -NoTypeInformation Now one more item, how do I get the OS profile that is set for the VM? $obj | Add-Member -MemberType NoteProperty -Name OSProfile -Value ????? Thanks
I have the script below... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) {     if($vm.config.hardware.NumCoresPerSocket -ne $null){         $cores = $vm... See more...
I have the script below... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) {     if($vm.config.hardware.NumCoresPerSocket -ne $null){         $cores = $vm.config.hardware.NumCoresPerSocket     }     else{         $cores = 1     }     $obj = new-object psobject     $obj | Add-Member -MemberType NoteProperty -Name ServerName -Value ($vm.Name)     $obj | Add-Member -MemberType NoteProperty -Name CPUs -Value ($vm.config.hardware.NumCPU)     $obj | Add-Member -MemberType NoteProperty -Name Sockets -Value ($vm.config.hardware.NumCPU/$cores)     $obj | Add-Member -MemberType NoteProperty -Name CPUPersocket -Value $cores     $obj | Add-Member -MemberType NoteProperty -Name RAMAssigned -Value $VM.MemoryGB     $result += $obj } $result | Out-File c:\temp\cputest.txt It runs but Memory is not populating. I must calling the value/property wrong. Also, how can I format the output to CSV? Thanks
Thanks, that worked. I have been gone from scripting for quite a while so I have more question. I'll start another thread.
I have the below script.... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) { $obj = new-object psobject $obj | Add-Member -MemberType NoteProperty -Name Serv... See more...
I have the below script.... $result = @() $vms = Get-view  -ViewType VirtualMachine foreach ($vm in $vms) { $obj = new-object psobject $obj | Add-Member -MemberType NoteProperty -Name ServerName -Value $vm.Name $obj | Add-Member -MemberType NoteProperty -Name CPUs -Value $vm.config.hardware.NumCPU $obj | Add-Member -MemberType NoteProperty -Name Sockets -Value ($vm.config.hardware.NumCPU/$vm.config.hardware.NumCoresPerSocket) $obj | Add-Member -MemberType NoteProperty -Name CPUPersocket -Value $vm.config.hardware.NumCoresPerSocket $result += $obj } $result | Out-File c:\temp\cputest.txt I'm getting the below error.... Attempted to divide by zero. At line:13 char:1 + $obj | Add-Member -MemberType NoteProperty -Name Sockets -Value ($vm. ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [], RuntimeException     + FullyQualifiedErrorId : RuntimeException How can I handle the error? The math indicates a VM does not have a CPU? Thanks
I use the Get-InventoryPlus function like below and it used to work.... Get-InventoryPlus | where {$_.Type -eq 'VirtualMachine'} | ForEach-Object -Process {    Add-Member -InputObject $_ -Me... See more...
I use the Get-InventoryPlus function like below and it used to work.... Get-InventoryPlus | where {$_.Type -eq 'VirtualMachine'} | ForEach-Object -Process {    Add-Member -InputObject $_ -MemberType NoteProperty -Name Datastore -Value ((Get-Datastore -VM $_.Name).Name -join '|')    Add-Member -InputObject $_ -MemberType NoteProperty -Name Network -Value ((Get-VirtualPortGroup -VM $_.Name).Name -join '|') -PassThru } | Export-Csv C:\Temp\Test.txt Now I get this.... Cannot convert the "System.Object[]" value of type "System.Object[]" to type "VMware.Vim.ManagedEntity". At C:\Temp\GetInventoryPlus-FolderPathDatastorePortgroup.ps1:125 char:11 +           $Object = Get-View -Id $Parent -Property Name,Parent +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidArgument: (:) [], RuntimeException     + FullyQualifiedErrorId : ConvertToFinalInvalidCastException Any ideas? Thanks
Yup, it came with RSAT. I uninstalled the hyper-v portion and all works now.
I'm thinking this module is the culprit... Binary     2.0.0.0    Hyper-V                             {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMGpu... I ran the c... See more...
I'm thinking this module is the culprit... Binary     2.0.0.0    Hyper-V                             {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMGpu... I ran the command... Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Tools-All But the module still exists. How do I get rid of that Powershell Hyper-V module?
OK, so I fully qualified the Get-VM commandlet like this and it works.... Get-Folder -Name 'sda' | VMware.VimAutomation.Core\Get-VM What's the appropriate fix? Thanks