• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

PowerCLI Script to turn off ESXi Host Lockdown Mode

I need a PowerCLI script that is designed to turn off the Lockdown Mode on several ESXi hosts. If someone has a script in their repository that would help with this problem I would greatly appreciate you sharing it with me.

Thank you,

Lipotech
0
lipotech
Asked:
lipotech
1 Solution
 
Luciano PatrãoICT Senior Infraestructure Engineer Commented:
Hi

Here is a good example written by Mark Strong

$vCenter = 'vCenterServer_Name_or_IP_address'
Connect-VIServer $vCenter
 $Scope = Get-VMHost #This will change the Lockdown Mode on all hosts managed by vCenter, amend this if you need to
 foreach ($ESXhost in $Scope) {
 (get-vmhost $ESXhost | get-view).ExitLockdownMode() # To DISABLE Lockdown Mode
 # (get-vmhost $ESXhost | get-view).EnterLockdownMode() # To ENABLE Lockdown Mode
 }
Disconnect-VIServer -Server $vCenter -Confirm:$false

Open in new window


Hope this helps you

Jail
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now