VMware Cloud Community
gurjitd
Contributor
Contributor

How to disable screen saver on all the MS VM's

Hi All,

I am looking for script which can disable the screen saver of all the Windows OS VM's, is there any Powershell script available which can do this ?

Regards

GD

0 Kudos
4 Replies
LucD
Leadership
Leadership

Are these guests in Active Directory ?

If yes, why don't you use a GPO to do that ?

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
gurjitd
Contributor
Contributor

Hi LUC,

Thanks for your reply, highly appreciable.

how can I do for the Vm's which are not in GPO ?

Regards

GD

0 Kudos
LucD
Leadership
Leadership

Provided the VMware Tools are installed on your guest, you can use the Invoke-VMScript cmdlet to change the registry value to defines if the screensaver is active.

Something like this

$vmName = <vm-name>
$bat = 'reg add "HKU\.Default\Control Panel\Desktop" /v "ScreenSaveActive" /t REG_SZ /d 0 /f'

$vm = Get-VM -Name $vmName
Invoke-VMScript -VM $vm -GuestUser <guest-user> -GuestPassword <guest-user-password> -HostUser <host-user> -HostPassword <host-user-password>  -ScriptType "bat" -ScriptText $bat

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
gurjitd
Contributor
Contributor

Hi,

Thanks Luc, I will try this, will let you know the status.

Regards

Gurjit Dhillon

0 Kudos