51 thoughts on “ADVERTISE”

  1. Hi Al,
    Firstly thank you for all your work,
    I am looking for a script which could set all the PSP to RR on LUNS other than RDM’s on the ESXi. can you please help.

  2. Hi, have a question about the script.

    Does the VMs Created or Cloned (Last x Day(s) only show per month ?

    Cause i need a report of the previous month
    so on the last day of the month i collect with the script, but there is now info about created, removed vm’s in the list 🙁

    i have set it to the last 30 days to look for.
    And there where creations and deletion of vm’s in that month.

  3. Hi ,

    Is there a way to shut the VM down , change the number of CPU and reboot again. I wanted to accomplish this my scheduling a POWERCLI script over night.


  4. Hi,

    Your scripts are really helpful. Looking for a script to get a list of VM’s in a folder in the following :


    Thanks in advance,

  5. Looks like I was using the wrong function. Using the following basic cmdlet worked perfectly fine:

    Get-VM | where {$_.CustomFields[“ShutdownDaily”] -eq “Yes”} | Shutdown-VMGuest -Confirm:$false

    Hope this helps anyone else wanting to do this.

  6. Hi Alan,

    Sorry to hear about the hack. Hope you nail down the culprits! I was wondering why I was not receiving updates with regards to my post in the vCheck section, but if you have a moment, could you lead me in the right direction concerning the below:

    I’ve created a Get-CustomField function to output certain VMs with a specific value in a custom field:

    function Get-CustomField {
    foreach ($cf in $item.CustomFields) {
    if ($cf.Value) {
    $field = “” | Select Key, Value, EntityName
    $field.key = $cf.Key
    $field.Value = $cf.Value
    $field.EntityName = $item.Name
    Write-Output $field

    Get-VM | Foreach { Get-CustomField $_ } | where {$_.value -eq “test”} | Out-GridView

    Now I would like to shutdown or start up these VMs with these values by using “Stop-VM” and “Start-VM” but it returns “The input object cannot be bound…” error. Is this possible using this function?

    Many thanks, and keep up the awesome work!

  7. Good afternoon!

    How is the site getting along again after the attack, al the scripts back online?

    I got your name from a colleague of mine. He told me you had a script that could convert all vpx MAC addresses to static MAC addresses, whilst maintaining the MAC address itself. This is used to retain IP information in the guest OS when the old VMXNET3 adapter is replaced by a new one, i.e. a copy of VM or start-from-backup in Veeam. Many thanks!!

  8. Alan,

    I just wanted to say thank you. I recently took a new job managing a medium size virtual environment and your many scripts have been invaluable to me. I have managed virtual environments for years but I had always been involved in the builing of the environment. Walking into a new environment I was not familiar with and that had been running for a few years, I was struggling to get a handle on everything. Your scripts have allowed me to get a much better understanding of how things are configured and find tons of things that are not configured in the best manner possible. While those things can be found manually looking at each VM, it is not very feasible when dealing with large numbers of hosts and VM’s. I look forward to seeing what you come up with next! Again, Thank you for your willingness to help others and your many contributions to us VMers.

  9. Hi, we are using the Vcheck report daily which is great, thanks. We have recently changed VM set up to have config files (and therefore snapshots) residing on a dedicated vDisk for each cluster. This is partly to ensure Veeam backup doesn’t inadvertently fill up a disk with snapshots.
    My Question, how do we modify the vcheck to flag any VM’s that do not have their config file on a specified LUN?


  10. Alan,
    We spoke briefly at VMWorld on the subject of moving vm’s from a 3.5 cluster to a 4.1 cluster using powershell, including upgrading tools, etc. I was wondering if you could shed some more light on this. I would like to do somewhat of a wholesale migration doing 10 to 15 machines at a time.

  11. Hi,

    Can you please add a script which displays the VMs having disks located on more than one datastore. We have policy in our environment and want to check whether if there is any VM stored on more than one datastore.

  12. Hi Alan,
    First of all, let me express my gratitude to your contributions which have helped all the admins around the whole world…Thanks a ton mate!!

    I was trying to modify your Audit.ps1 (workstation/Server Audit script) for my sharepoint dashboard. I am facing a problem and not able to think out a way of it. (Newbie to PS :))

    I am trying to import csv which lists hardended services requirements (e.g Windows Installer should be disabled etc) and lookup through each service in the script and compare to the current server services…if it requirement is met then it returns compliant or else non-compliant….

    all is fine but somehow for my foreach statement, it only compares the last entry in my imported csv and not all which should be normal…don’t understand what I’m missing…..can pls advice?

    the function I changed:-
    Write-Output “..Services”

    $ListOfServices = Get-WmiObject -ComputerName $Target Win32_Service

    $complianceservice = Import-Csv service2k3.csv

    $MyReport += Get-CustomHeader “2” “Services”

    $Services = @()

    Foreach ($Service in $ListOfServices){

    ForEach ($name in $complianceservice){

    $Details = “” | Select Name,”Logon As”,”Startup Mode”,Status,”Expected Status”,”Compliance Check”

    $Details.Name = $Service.displayname

    $Details.”Logon As” = $Service.Startname

    $Details.”Startup Mode” = $Service.StartMode

    If ($Service.StartMode -eq “Auto”)


    if ($Service.state -eq “Stopped”)


    $Details.Status = $Service.state

    $Details.”Expected Status” = “Unexpected”



    If ($Service.StartMode -eq “Auto”)


    if ($Service.state -eq “Running”)


    $Details.Status = $Service.state

    $Details.”Expected Status” = “OK”



    If ($Service.StartMode -eq “Disabled”)


    If ($Service.state -eq “Running”)


    $Details.Status = $Service.state

    $Details.”Expected Status” = “Unexpected”



    If ($Service.StartMode -eq “Disabled”)


    if ($Service.state -eq “Stopped”)


    $Details.Status = $Service.state

    $Details.”Expected Status” = “OK”



    If ($Service.StartMode -eq “Manual”)


    $Details.Status = $Service.state

    $Details.”Expected Status” = “OK”


    If ($Service.state -eq “Paused”)


    $Details.state = $Service.state

    $Details.”Expected Status” = “OK”


    If ($($name.name) -eq $service.displayname -and $name.startmode -ne $Service.StartMode)


    $Details.”Compliance Check” = “Non-Compliant”


    If ($($names.name) -eq $service.displayname -and $Service.startmode -eq $name.Startmode)


    $Details.”Compliance Check” = “Compliant”


    If ($($name.name) -ne $Service.displayname)


    $Details.”Compliance Check” = “Third Party”



    $Services += $Details


  13. Hi Al,

    Thanks for the workstation/server audit script managed to get a copy couple weeks ago. Pity people are taking your hard work and passing off as their own. I tried to modify the script a little bit to add Server Roles to the script but my powershell scripting is not as strong at the moment so abandoned that, maybe you can add that in future releases

    Thanks for all your hard work tho … any chance of you coming up with a health check script for hyper-v?

  14. Hi Al,

    Great script, just recently started using it and have already identified a number of issues that have so far been missed.

    I have however had to modify the script to get some extra stats out

    1) Enable email via a authenticated relay

    # Set relay username and password
    $SmtpUser = “username”
    $SmtpPass = “password”

    function Send-SMTPmail($to, $from, $subject, $smtpserver, $body) {
    $mailer = new-object Net.Mail.SMTPclient($smtpserver)
    $mailer.Credentials = [System.Net.NetworkCredential]::($SmtpUser, $SmtpPass)
    $msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
    $msg.IsBodyHTML = $true

    2) Added a Capacity Planning section based on a percentile variable, using the max cpu and memory. This was to cover a “perfect storm” scenario, all vms at x% usage and y (where y = host redundancy level) hosts have failed, I admit its not perfect but I think it gives an rough indication. And in our instance our tolerance would be somewhere between the average and max values of Capacity Planning results. Whether this is useful to others or not Im not sure. This does require that logging be set to level 4 in virtual center

    # Max Capacity info (used to estimate perfect storm scenarios). Requires logging level 4 to be set in virtual center
    $percentile = 80
    $ShowMaxCapacityInfo = $true

    # Capacity Planner Info (MAX/Percentile)
    if ($ShowMaxCapacityInfo){
    Write-CustomOut “..Checking Capacity Info (MAX/Percentile)”
    $capacityinfo = @()

    foreach ($cluv in (Get-View -ViewType ClusterComputeResource)){
    if ((Get-Cluster $cluv.name|Get-VM).count -gt 0){
    $clucapacity = “” |Select ClusterName, “Estimated Num VM Left (CPU)”, “Estimated Num VM Left (MEM)”
    $DasRealCpuCapacity = $cluv.Summary.EffectiveCpu – (($cluv.Summary.EffectiveCpu*$cluv.Configuration.DasConfig.FailoverLevel)/$cluv.Summary.NumEffectiveHosts)
    $CluCpuUsage = get-stat -entity $cluv.name -stat cpu.usagemhz.maximum -Start ($Date).adddays(-7) -Finish ($Date) | Sort-Object Value -descending
    $CluCpuUsageValueCount = $CluCpuUsage | Measure-Object
    $CluCpuUsageValuePoint = [math]::round(($CluCpuUsageValueCount.count/100)*(100-$percentile),0)+1
    $CluCpuUsagePercentileValue = $CluCpuUsage[$CluCpuUsageValuePoint]
    $VmCpuAverage = $CluCpuUsagePercentileValue.value /(Get-Cluster $cluv.name|Get-VM).count
    $CpuVmLeft = [math]::round(($DasRealCpuCapacity-$CluCpuUsagePercentileValue.value)/$VmCpuAverage,0)

    $DasRealMemCapacity = $cluv.Summary.EffectiveMemory – (($cluv.Summary.EffectiveMemory*$cluv.Configuration.DasConfig.FailoverLevel)/$cluv.Summary.NumEffectiveHosts)
    $CluMemUsage = get-stat -entity $cluv.name -stat mem.consumed.maximum -Start ($Date).adddays(-7) -Finish ($Date) | Sort-Object Value -descending
    $CluMemUsageValueCount = $CluMemUsage | Measure-Object
    $CluMemUsageValuePoint = [math]::round(($CluMemUsageValueCount.count/100)*(100-$percentile),0)+1
    $CluMemUsagePercentileValue = $CluMemUsage[$CluMemUsageValuePoint]
    $VmMemAverage = ($CluMemUsagePercentileValue.value/1024) /(Get-Cluster $cluv.name|Get-VM).count
    $MemVmLeft = [math]::round(($DasRealMemCapacity-($CluMemUsagePercentileValue.value/1024))/$VmMemAverage,0)

    $clucapacity.ClusterName = $cluv.name
    $clucapacity.”Estimated Num VM Left (CPU)” = $CpuVmLeft
    $clucapacity.”Estimated Num VM Left (MEM)” = $MemVmLeft

    $capacityinfo += $clucapacity
    If (($capacityinfo | Measure-Object).count -gt 0) {
    $MyReport += Get-CustomHeader “Capacity Planner Info (Based on maximum/percentile usage)” “The following gives brief capacity information for each cluster based on Maximum/Percentile CPU/Mem usage and counting for HA failover requirements in the event of a perfect storm scenario. IE host fails and all VMs run at $percentile %”
    $MyReport += Get-HTMLTable $capacityinfo
    $MyReport += Get-CustomHeaderClose

  15. I will be looking out a script to query the information of Vmotion/ Vmkernel port info. of an ESX hosts. Data out put in excel filed.

    The Output data should include following details

    Host name, IP address of Service console

    1. Vmotion port configured Virtual Switch info.
    2. IP Address configured for Vmotion
    3. Subnet Mask
    4. Gateway
    5. VLAN ID
    6. VMnic info. (like vmnic1, vmnic2)
    7. CDP info. of vmnic’s configured for vmotion/ vmkernal port.

  16. Al,

    I have been running your script for the better aprt of a year now and it suddenly quit sending mail. I have confirmed that the script still runs and will display the output to the console, but when I configure to send mail, I never get it.

    Any ideas? Is there some additional debug parms?


  17. Al,
    I love the vCheck script and use it regularly for server auditing. However, I’d like to understand how to change three aspects of the script:
    1. Report in excel vice html
    2. Report on multiple servers in one report
    3. Report on any combination of characteristics: ie hotfixes and printers for the multiple servers.

    Thanks in advance for your help.

  18. Hi there,

    Thanks for your vcheck script. I am very new to powershell and I wad wondering if in the snapshots category, in addition of having that total size of the vm under “sizeMB”, could we also have the size taking by the snapshots.

    I am interested in the amount of data space that is taken by the actual snapshot.

  19. Could you add the extra features of this healt check script? http://www.ivobeerens.nl/?p=256

    Especially the “vmware tools old” section?
    This way we keep in mind to update to the latest version.

    Note that I have “Unable to populate snapshot size due to unsufficient permissions”, however the user I run the script with should have enough priviliges.


  20. Something happened to the code then….not sure what.

    Put the Cluster Name after the get-cluster cmdlet. Like get-cluster MyCluster | …..

    Omit the get-cluster cmdlet to shut down every VM on the VC.

  21. @Rusty
    Try somehting like
    get-cluster | get-vm | Where-Object {$_.powerstate -eq “PoweredOn”} | shutdown-VMGuest

    You would have to be connected to the VC, that should be a good place to start.

  22. Hey there, Like the scripts you have obvious.ly put in a lot of time on this! I did note one omission, a script to shutdown multiple VMs in the event you need to power down a cluster or the entire infrastructure. So if you have one handy or know where to point me I would appreciate it….

  23. Hi Alan,

    Could you please help. I have just patched all my hosts and I need to upgrade the tools on the guests. Is it possible to pass the update-tools cmdlet a parameter such as remove=hgfs. from what I can see this has been deprecated in PowerCli 4.0U1


  24. Hi Alan,

    I’ve been using your daily checks scripts for sometime now and can honestly say it helps me immeasurably.

    We’ve recently upgraded our backup solution to a product that fully integrates with the new change block tracking features in the vStorage API. However, to get this fully working i need to add and set the ctkEnabled=true value in the configuration paraments as well as adding and setting the scsi0:0.ctkEnabled = true value for each virtual disk.

    Is there an easy we to do this with powershell other than updating each VM indiviually?



  25. I saw a webinar today that showed your powerpack for the virtualization echoshell.
    Where can I download this?

  26. Awesome work all around!!! Really appreciate your scripts. Thank you.

    I have noticed a new problem cropping up in vSphere 4. It seems that they added NUMA verification to the lastest code. So if your hosts do not have the correct memory layout then you will get errors on your ESX host. Is it possible to add a VESI script to check for memory layout? Maybe a best practice query?


  27. Hi

    I new on poweshell, but it seem to be great tool.
    I tryed dailyreport with the folowing problem.

    Please specify a VI Server name eg….
    powershell.exe DailyReport.ps1

    What have i missed?

  28. Suggestion for a script, may not be easy.
    Basic idea is that VMotion can screw up the auto-start for VMs (turn it off), why not have a script that runs daily and resets the desired auto-start of one’s important VMs??
    There is I know a best practice for restarting VMs, it’s something like: AD/DNS virtual server if there is one (we also have a physical one), Virtual Center server, then other servers as desired.
    One might or might not have DRS enabled, one likely has HA started.
    Perhaps the user must create a text file with a list of VM names and a note about what is the VM’s function.
    The script could look at this list, compare it to the existing list of VMs on the host, then do what is necessary to ensure the VMs are correctly set to auto-start, plus send a message to someone about this too.
    It could become an adjunct to vCheck Daily Report??
    Thank you for reading this, Tom

  29. Man that was quick!! Silly me…..I have “Set-ExecutionPolicy Restricted” at the tail end of a script that runs daily to query some basic Exchange information. That must have blocked it. Thanks a bunch for pointing me in the right direction. I’ll continue to be an avid reader of your blog.

  30. I bumped into your site by accident and I seem to have stumbled on a pot of gold. I’m a PowerShell beginner and wanted to know how to properly run your Audit.PS1 script. When I run it on my test machine (right click and Run with PowerShell), the PowerShell windows comes up and then disappears about 10 seconds later. Is there something I’m doing wrong? Thanks for your time.

  31. Hi Al,

    I use your script regularly, but i hate flat file and i love wiki. so i change some bits to fit my needs and know i can automatically integrate my Vm Environment in my (self wiki made) CMDB

    Many thanks’ for your base script , and try mine if you have time

    Ph Koenig
    Aka UnclePhil

  32. Al,

    I ran across your “Audit Script” on poshcode.com. There is a parser error that keeps coming up near the end and it looks like the file got cut off. Do you have any thoughts so I could try this?



  33. @Joakim
    Do you think that would be more useful than the vm’s created in the previous x days ? Its easily done but I think I will keep it as it is, Don’t worry though I will do a seperate post showing how to get this info so you can add it easily.

  34. Hi!

    Very Nice Script!
    A very nice to have feature in the script would be if it showed the last 10-20 created machines. Is that possible? Something you allready thought of?


  35. Hi,

    I saw your DailyReport script and it looks great but did not see any instructions on what is required to run it? Do you perhaps have some detail installation instructions for this, I’m sorry but I’m new to powershell.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Living in software defined reality

%d bloggers like this: