PowerShell
List Active Directory users that have never logged in including built-in users using PowerShell
I was trying to find a way to identify what the unused user accounts were in my AD environment. I started playing with PowerShell’s get-aduser cmd-let. The working script that I came up with is below. get-aduser -f {-not ( lastlogontimestamp -like “*”) -and (enabled -eq $true)} | select name
Tags: Active Directory, PowerShell
Posted in Active Directory, Microsoft, Powershell | No Comments »
Update the DNS Suffix on your cluster of ESX hosts using PowerCLI
Using PowerCLI, you can quickly update the DNS Suffix on the hosts in your cluster using this short one-liner. get-cluster “LabManager” | get-vmhost | get-vmhostnetwork | set-vmhostnetwork -searchdomain “one.lab.org”, “two.lab.org”
Tags: cloud, PowerCLI, PowerShell, vmware
Posted in Cloud, PowerCLI, Powershell, vmware | No Comments »
List the vMotion IP Address and Subnet mask for each vSphere ESX host using PowerCLI
I ran into a couple misconfigurations, so I wrote a quick online to audit all of my host configurations without having to use the dreaded host profiles get-vmhost | % {(get-view $_.id).config.vmotion.ipconfig} | select ipaddress, subnetmask
Tags: PowerCLI, PowerShell, vmware
Posted in Cloud, PowerCLI, Powershell, vmware | 1 Comment »
List the Path and Path State for every vSphere Datastore using PowerCLI
List the Path and Path State for every vSphere Datastore and then output to CSV using PowerCLI $initalTime = Get-Date $filepath = “C:\tmp” $filename = “LunPathState” $date = Get-Date ($initalTime) -uformat %Y%m%d $time = Get-Date ($initalTime) -uformat %H%M Write-Host “$(Get-Date ($initalTime) -uformat %H:%M:%S) – Starting” $AllHosts = Get-VMHost | Sort Name $reportLunPathState = @() Write-Host […]
Tags: PowerCLI, PowerShell, vmware
Posted in Cloud, PowerCLI, Powershell, vmware | 14 Comments »