Mahiee's Posts

Dears, We have a VM which seems to be missed from vCenter or it might never been in vCenter, which I want to trace it out. At present the VM is not showing in the vCenter hierarchy, but it is... See more...
Dears, We have a VM which seems to be missed from vCenter or it might never been in vCenter, which I want to trace it out. At present the VM is not showing in the vCenter hierarchy, but it is still online and accessible. we have only one vCenter with lot of VMs. Now I would like to get the host name from inside OS, can anyone please suggest me in this regards. ESXi version - 5.5 VM Guest OS - windows. I have already googled and reviewed some blogs but not working. Many Thanks, - Rachis.
Dear All, I would like to extend a disk to certain size on multiple VM (Morethan 200), presume it is huge time taking, can anyone please suggest with any script which would allow me to do it t... See more...
Dear All, I would like to extend a disk to certain size on multiple VM (Morethan 200), presume it is huge time taking, can anyone please suggest with any script which would allow me to do it through automation. Thanks in Advance. Rachis!
Thanks I already reviewed them those will export the old events, Just curious to know if there is any quick command to get it on board. Rachis.
Hi Everyone, I have VM which is idle in the inventory since long, now would like to know when it was created and who has created. From Tasks and Events couldn't get it. And in our invent... See more...
Hi Everyone, I have VM which is idle in the inventory since long, now would like to know when it was created and who has created. From Tasks and Events couldn't get it. And in our inventory most of the VMs would deploy from template. Any command or script to identify these details! Thanks in Advance. Rachis.
Dear All[, I would like to export all the VMs from inventory with the details which are running with VMDK and which are with RDM. Can I have a script which will help me to achieve this targ... See more...
Dear All[, I would like to export all the VMs from inventory with the details which are running with VMDK and which are with RDM. Can I have a script which will help me to achieve this target. Thanks in advance. Rachis
Hi LucD,  sems above link is not working today! Can you please check and confirm if there is any issue.
Thank you very much, surprising I got below warnings, can you please confirm if they are safe? WARNING: The 'Description' property of VirtualMachine type is deprecated. Use the 'Notes' prop... See more...
Thank you very much, surprising I got below warnings, can you please confirm if they are safe? WARNING: The 'Description' property of VirtualMachine type is deprecated. Use the 'Notes' property instead. WARNING: The 'HardDisks' property of VirtualMachine type is deprecated. Use 'Get-HardDisk' cmdlet instead. WARNING: The 'NetworkAdapters' property of VirtualMachine type is deprecated. Use 'Get-NetworkAdapter' cmdlet instead. WARNING: The 'UsbDevices' property of VirtualMachine type is deprecated. Use 'Get-UsbDevice' cmdlet instead. WARNING: The 'CDDrives' property of VirtualMachine type is deprecated. Use 'Get-CDDrive' cmdlet instead. WARNING: The 'FloppyDrives' property of VirtualMachine type is deprecated. Use 'Get-FloppyDrive' cmdlet instead. WARNING: The 'Host' property of VirtualMachine type is deprecated. Use the 'VMHost' property instead. WARNING: The 'HostId' property of VirtualMachine type is deprecated. Use the 'VMHostId' property instead. WARNING: PowerCLI scripts should not use the 'Client' property. The property will be removed in a future release.
Thank you so much for your response, but seems the below command is help to power on the server if that is in powered down state, it is not helping me to restart. Can you please suggest me the c... See more...
Thank you so much for your response, but seems the below command is help to power on the server if that is in powered down state, it is not helping me to restart. Can you please suggest me the command for restart the servers. $vmNames = Get-Content -Path vmnames.txt Get-VM -Name $vmNames | Start-VM -Confirm:$false And in the below command powerstate result is not coming, can you please help me with the command for getting power state and also the last reboot time. Thanks again. Rachis.
Dear All, Often I have a requirement to restart multiple VMs, so I usually do it manually through vCenter. But if it is more than 20 or 30 or so, it would be lot of time consumption, theref... See more...
Dear All, Often I have a requirement to restart multiple VMs, so I usually do it manually through vCenter. But if it is more than 20 or 30 or so, it would be lot of time consumption, therefore can anyone please suggest me with the script which helps me to automate it. The list of servers are not same for every time, so i'm looking if there is any option to store my servers in notepad and that will be called through script, post completion also there must be option to get the result of servers reboot status in output file. Thank you very much for your suggestions. Rachis.
Thank again for your prompt response, Can you please validate the below script which would help my above two requirement or any amendments required (Script 1 + Script 2) Also kindly confir... See more...
Thank again for your prompt response, Can you please validate the below script which would help my above two requirement or any amendments required (Script 1 + Script 2) Also kindly confirm where the results will be stored with this script. (Any location has to be give!) ************************************************************** function Remove-OrphanedData { <# .SYNOPSIS   Remove orphaned folders and VMDK files .DESCRIPTION   The function searches orphaned folders and VMDK files on one or more datastores and reports its findings. Optionally the function removes  the orphaned folders   and VMDK files .NOTES   Author:  Luc Dekens .PARAMETER Datastore One or more datastores. The default is to investigate all shared VMFS datastores .PARAMETER Delete A switch that indicates if you want to remove the folders and VMDK files .EXAMPLE PS> Remove-OrphanedData -Datastore ds1 .EXAMPLE PS> Get-Datastore ds* | Remove-OrphanedData .EXAMPLE PS> Remove-OrphanedData -Datastore $ds -Delete #> [CmdletBinding(SupportsShouldProcess=$true)] param( [parameter(Mandatory=$true,ValueFromPipeline=$true)] [PSObject[]]$Datastore ) begin{ $fldList = @{} $hdList = @{} $fileMgr = Get-View FileManager } process{ foreach($ds in $Datastore){ if($ds.GetType().Name -eq "String"){ $ds = Get-Datastore -Name $ds } if($ds.Type -eq "VMFS" -and $ds.ExtensionData.Summary.MultipleHostAccess){ Get-VM -Datastore $ds | %{ $_.Extensiondata.LayoutEx.File | where{"diskDescriptor","diskExtent" -contains $_.Type} | %{ $fldList[$_.Name.Split('/')[0]] = $_.Name $hdList[$_.Name] = $_.Name } } Get-Template | where {$_.DatastoreIdList -contains $ds.Id} | %{ $_.Extensiondata.LayoutEx.File | where{"diskDescriptor","diskExtent" -contains $_.Type} | %{ $fldList[$_.Name.Split('/')[0]] = $_.Name $hdList[$_.Name] = $_.Name } } $dc = $ds.Datacenter.Extensiondata $flags = New-Object VMware.Vim.FileQueryFlags $flags.FileSize = $true $flags.FileType = $true $disk = New-Object VMware.Vim.VmDiskFileQuery $disk.details = New-Object VMware.Vim.VmDiskFileQueryFlags $disk.details.capacityKb = $true $disk.details.diskExtents = $true $disk.details.diskType = $true $disk.details.thin = $true $searchSpec = New-Object VMware.Vim.HostDatastoreBrowserSearchSpec $searchSpec.details = $flags $searchSpec.Query += $disk $searchSpec.sortFoldersFirst = $true $dsBrowser = Get-View $ds.ExtensionData.browser $rootPath = "[" + $ds.Name + "]" $searchResult = $dsBrowser.SearchDatastoreSubFolders($rootPath, $searchSpec) foreach($folder in $searchResult){ if($fldList.ContainsKey($folder.FolderPath.TrimEnd('/'))){ foreach ($file in $folder.File){ if(!$hdList.ContainsKey($folder.FolderPath + $file.Path)){ New-Object PSObject -Property @{ Folder = $folder.FolderPath Name = $file.Path Size = $file.FileSize CapacityKB = $file.CapacityKb Thin = $file.Thin Extents = [string]::Join(',',($file.DiskExtents)) } } } } } } } } } }
Thank you so much LucD, Well I strongly agree with you. May I request you to help in the below format so that it would be fulfill my target precisely. Script 1 - Export all the Orphaned ... See more...
Thank you so much LucD, Well I strongly agree with you. May I request you to help in the below format so that it would be fulfill my target precisely. Script 1 - Export all the Orphaned files from the vCenter inventory. Script 2 - check and return the result that the script 1 results are not registered with any VM. Or can we have a check point like try to rename the files, if it is already in use it wont allow to rename. Script 3 - Delete all the VMDK orphaned files which are validated in Script 2. Much appreciated if you can help with that, it means a lot. Even if you can give me one script where three functions all together consists is welcomed. Thank you so much as always!
Thank you very much for your script, well if we have a script or a command to check (review) whether that VMDK is used or unused that would be very helpful and also make my target done very quick... See more...
Thank you very much for your script, well if we have a script or a command to check (review) whether that VMDK is used or unused that would be very helpful and also make my target done very quickly. I request can you also please propose with script or command (or may be different script is also OK) just to "review the orphaned files" and return that is really unused. Thanks a lot. Rachis.
I really mean to delete the orphaned vmdk files. Thank you so much for your response.
Dear All - I found lot of Zombie files as per RVtools report, which I would like to review and delete them but as the list is huge it would take much time. Can someone please help me with the ... See more...
Dear All - I found lot of Zombie files as per RVtools report, which I would like to review and delete them but as the list is huge it would take much time. Can someone please help me with the script which must first check that LUN is truly unused and then go for deletion. 1. check and give the result that the LUN is unused. 2. Delete the LUN which is unused. 3. Return the LUN result which might be used Thanks in Advance. Rachis.
Hello, I have added vCPU from 2 to 8 to my win 2012 VM but it is not reflecting inside OS. VM summery it is giving correct information and also in Device Manager of that server but not in Comp... See more...
Hello, I have added vCPU from 2 to 8 to my win 2012 VM but it is not reflecting inside OS. VM summery it is giving correct information and also in Device Manager of that server but not in Computer properties not in Task manager. kindly someone please suggest in this regards., As per Conversation in - https://communities.vmware.com/message/2634592#2634592 I have checked and confirmed "cpuid.coresPerSocket" is already added with value 6. Thanks.,
I'm also having the same kind of issue whereas my OS version is win 2012. I have extended vCPU from 2 to 8 but still that is not reflecting inside OS. As per above suggestion I have checked... See more...
I'm also having the same kind of issue whereas my OS version is win 2012. I have extended vCPU from 2 to 8 but still that is not reflecting inside OS. As per above suggestion I have checked the "cpuid.coresPerSocket" which is already added with value 6. kindly suggest. thanks
I'm looking for some script or any other workaround to export all vCenter roles to excel or csv,lets say it might be for audit purpose. Kindly let me in this regards, Thanks in advance. Rac... See more...
I'm looking for some script or any other workaround to export all vCenter roles to excel or csv,lets say it might be for audit purpose. Kindly let me in this regards, Thanks in advance. Rachis
LucD, I'm back to seek your suggestion, if I would like to delete or create a snapshot morethan 20 which are not same for everytime it is becoming time taken to place all of them after $vmNames w... See more...
LucD, I'm back to seek your suggestion, if I would like to delete or create a snapshot morethan 20 which are not same for everytime it is becoming time taken to place all of them after $vmNames with single codes, so can you please propose if there is way around to paste all of servers in notepad and that will be called while create/delete the snapshot. Many Thanks.
I attached it here.
I have able to copy the Script, thanks. But when I run the script I'm getting below error, can you please suggest. + "@ $LunInfoDef = "public struct LunInfo" + $rndNum + "{`n" + $LunInfoDef... See more...
I have able to copy the Script, thanks. But when I run the script I'm getting below error, can you please suggest. + "@ $LunInfoDef = "public struct LunInfo" + $rndNum + "{`n" + $LunInfoDef +    ~~~~~~~~~~~ Unexpected token '$LunInfoDef' in expression or statement. At C:\temp\FreeLuns.ps1:13 char:17 +  $scsiTab = @{} $esxServers | %{ +                 ~~~~~~~~~~~ Unexpected token '$esxServers' in expression or statement. At C:\temp\FreeLuns.ps1:32 char:1 + } + ~ Unexpected token '}' in expression or statement.     + CategoryInfo          : ParserError: (:) [], ParseException     + FullyQualifiedErrorId : UnexpectedToken