Scripting question...

I'm sure this question has been asking a hundred times but I cant seem to find the answer so here we go...I'd like to see if anyone has a script (powershell?) already put together that will disable the screen saver on all the virtual machines registered to our vCenter server.

Has anyone come accross this before?

Any help would be appreciated.


0 Kudos
2 Replies

Actually, not heard that one before. Smiley Happy

If you have PowerShell on all of your guests, then check out Invoke-VMScript. But that is besides the point, as I'd actually recommend you do this with a Group Policy. That would be a much more effective and in the long run, comprehensive, way to make workstation changes like this.

[vExpert|], PowerShell MVP, VI Toolkit forum moderator

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (

Need general, non-VMware-related PowerShell Help? Try the forums at

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
Hot Shot
Hot Shot

I agree with Hal that Group Policy is the better solution. But if you are still interested in a VITK script here you go:

As Hal mentioned Invoke-VmScript is the cmdlet that will do the trick. To use that cmdlet there are some certain prerequisits(those are not that much) which are well explained here:

You will also need a windows commandline tool that can disable the screensaver. I found one called: flipss.exe available at:

So the script that should do what you are looking for looks something like this:

Note: If you dont have common accounts with same credentials for all esx hosts and respectively for all guest Os's then you should modify the script to handle this

$vmHostUserName = "hostAccount"

$vmHostPassword = "pass"

$guestOsUserName = "guestAccount"

$guestOsPassword = "pass"

Connect-VIServer -Server -User Admin -Password pass

Get-Vm | Invoke-VmScript -ScriptText "C:\MyFiles\flipss.exe /off" -HostUser $vmHostUserName -HostPassword $vmHostPassword -GuestUser $guestOsUserName -GuestPassword $guestOsPAssword

Hope this helps,


0 Kudos