Created
November 10, 2017 14:09
-
-
Save peterhynes/80604b249ef2b3462dc9879f7aa24596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Script to pull local permissions on esxi hosts | |
| #Version 1.0 | |
| #@Peter Hynes | |
| #Created on Nov 9th 2017 | |
| #You will need to create 3 txt files and populate them hosts.txt, vcs.txt and ilos.txt. Place these files in the same folder as this script. | |
| #Load powercli modules | |
| Get-Module -Name VMware* -ListAvailable | Import-Module | |
| Add-PSSnapin vmware* | |
| $esxihosts = get-content .\hosts.txt | |
| $password = Read-Host "Enter root password" | |
| ForEach ($esxihost in $esxihosts) { | |
| Write-host "Connecting to $esxihost..." -foregroundcolor "yellow" | |
| Connect-VIServer $esxihost -User root -Password $password | |
| Get-VIPermission | select @{N="Host";E={Get-VMHost | select -ExpandProperty Name}}, Principal | Export-Csv -Append -Path .\hostReport.csv -UseCulture -NoTypeInformation | |
| Disconnect-VIServer -Server $esxihost -Confirm:$False | |
| } | |
| Write-Host "Script complete" -foregroundcolor "yellow" | |
| .\hostReport.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment