VMware Cloud Community
Gonzouk
Enthusiast
Enthusiast

Powershell scripts to show health and alarms?

Hello,

Is there a powercli script that any other you can share that I can use daily to give me a health view of our vCenter environment.  I have some powercli scripts already running that email snapshot and datastore info, this done via the Windwos scheduler tool and would like to do a similar thing for the hosts?

Thanks

Reply
0 Kudos
9 Replies
LucD
Leadership
Leadership

The vCheck script comes to mind.

You can configure the snapins you want to use in the report.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
cjscol
Expert
Expert

Alan Renouf's vCheck is excellent, http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/

Calvin Scoltock VCP 2.5, 3.5, 4, 5 & 6 VCAP5-DCD VCAP5-DCA http://pelicanohintsandtips.wordpress.com/blog LinkedIn: https://www.linkedin.com/in/cscoltock
Reply
0 Kudos
Gonzouk
Enthusiast
Enthusiast

Thanks VCheck looks amazing.

It's currently running, but I keep getting the odd:

Security warning

Run only scripts that you trust. While scripts from the internet can be useful,

this script can potentially harm your computer. If you trust this script, use

the Unblock-File cmdlet to allow the script to run without this warning

message. Do you want to run C:\vmware\powercli\vCheck\Plugins\20 Cluster\38

Cluster Configuration Issues.ps1?

[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"):

I did set the set-execusionpolicy to unrestricted too

any ideas?

Reply
0 Kudos
LucD
Leadership
Leadership

When you download scripts, you will have to unblock them (provided you trust them of course).

When you have downloaded and extracted everything into a folder C:\vCheck, you can do

Get-ChildItem C:\vCheck | Unblock-File


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Gonzouk
Enthusiast
Enthusiast

So I should continue with hitting "R" then when finished run?

Get-ChildItem C:\vCheck | Unblock-File

Reply
0 Kudos
LucD
Leadership
Leadership

Try with the Confirm switch

Unblock-File -Confirm:$false


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Gonzouk
Enthusiast
Enthusiast

It run through it all and seemed to run lots of plugins and miss some then open a blank html?

[12:42:00] ..start calculating VMs Ballooning or Swapping by Alan Renouf, Frederic Martin v1.1 [70 of 110]

. : File C:\vmware\powercli\vCheck\Plugins\60 VM\12 VMs Swapping or Ballooning.ps1 cannot be loaded. The file

C:\vmware\powercli\vCheck\Plugins\60 VM\12 VMs Swapping or Ballooning.ps1 is not digitally signed. You cannot run this

script on the current system. For more information about running scripts and setting execution policy, see

about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

At C:\vmware\powercli\vCheck\vCheck.ps1:669 char:56

+    $TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSecond ...

+                                                        ~~~~~~~~~~~

    + CategoryInfo          : SecurityError: (:) [], PSSecurityException

    + FullyQualifiedErrorId : UnauthorizedAccess

[12:42:00] ..finished calculating VMs Ballooning or Swapping by Alan Renouf, Frederic Martin v1.1 [70 of 110]

[12:42:00] ..start calculating Invalid or inaccessible VM by Alan Renouf v1.1 [71 of 110]

. : File C:\vmware\powercli\vCheck\Plugins\60 VM\13 Invalid or inaccessible VMs.ps1 cannot be loaded. The file

C:\vmware\powercli\vCheck\Plugins\60 VM\13 Invalid or inaccessible VMs.ps1 is not digitally signed. You cannot run

this script on the current system. For more information about running scripts and setting execution policy, see

about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

At C:\vmware\powercli\vCheck\vCheck.ps1:669 char:56

+    $TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSecond ...

+                                                        ~~~~~~~~~~~

    + CategoryInfo          : SecurityError: (:) [], PSSecurityException

    + FullyQualifiedErrorId : UnauthorizedAccess

[12:42:00] ..finished calculating Invalid or inaccessible VM by Alan Renouf v1.1 [71 of 110]

[12:42:00] ..start calculating VMs restarted due to Guest OS Error by Alan Renouf v1.1 [72 of 110]

[12:42:00] ..finished calculating VMs restarted due to Guest OS Error by Alan Renouf v1.1 [72 of 110]

[12:42:01] ..start calculating Guests with less than $MBFree MB by Alan Renouf v1.1 [73 of 110]

[12:42:01] ..finished calculating Guests with less than $MBFree MB by Alan Renouf v1.1 [73 of 110]

[12:42:01] ..start calculating Checking VM Hardware Version by Alan Renouf v1.1 [74 of 110]

[12:42:01] ..finished calculating Checking VM Hardware Version by Alan Renouf v1.1 [74 of 110]

[12:42:01] ..start calculating VMs in inconsistent folders by Alan Renouf v1.2 [75 of 110]

[12:42:01] ..finished calculating VMs in inconsistent folders by Alan Renouf v1.2 [75 of 110]

[12:42:01] ..start calculating No VM Tools by Alan Renouf v1.1 [76 of 110]

[12:42:01] ..finished calculating No VM Tools by Alan Renouf v1.1 [76 of 110]

Reply
0 Kudos
Gonzouk
Enthusiast
Enthusiast

last part that ran was this:

[12:43:14] ..start calculating Disconnecting from vCenter by Alan Renouf v1.1 [110 of 110]

. : File C:\vmware\powercli\vCheck\Plugins\80 Finish\999 VeryLastPlugin Used to Disconnect.ps1 cannot be loaded. The

file C:\vmware\powercli\vCheck\Plugins\80 Finish\999 VeryLastPlugin Used to Disconnect.ps1 is not digitally signed.

You cannot run this script on the current system. For more information about running scripts and setting execution

policy, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

At C:\vmware\powercli\vCheck\vCheck.ps1:669 char:56

+    $TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSecond ...

+                                                        ~~~~~~~~~~~

    + CategoryInfo          : SecurityError: (:) [], PSSecurityException

    + FullyQualifiedErrorId : UnauthorizedAccess

[12:43:14] ..finished calculating Disconnecting from vCenter by Alan Renouf v1.1 [110 of 110]

Get-ReportHTML : The term 'Get-ReportHTML' is not recognized as the name of a cmdlet, function, script file, or

operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

again.

At C:\vmware\powercli\vCheck\vCheck.ps1:748 char:13

+ $MyReport = Get-ReportHTML

+             ~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Get-ReportHTML:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

[12:43:17] ..Displaying HTML results

Reply
0 Kudos
LucD
Leadership
Leadership

You can, if that is allowed in your environment, remove the script signature requirement by changing the execution policy.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos