Tuesday, October 31, 2017

Powershell Script to get Clustername from Ad Computer Object


We can get Adcomputerobjects from Ad..But how to filter or list out  the Cluster name from Ad.

Below is a simple Powershell Script to get Cluster name(Alias) from Ad Computer Object


Get-ADComputer -Filter 'servicePrincipalName -Like "*MSClusterVirtualServer*"' -Properties Name, LastLogonTimestamp, pwdLastSet, servicePrincipalName| Select Name, @{n='LastLogonTimestamp';e={[DateTime]::FromFileTime($_.LastLogonTimestamp)}}, @{n='pwdLastSet';e={[DateTime]::FromFileTime($_.pwdLastSet)}}, DistinguishedName 



Regards
Bijesh

No comments:

Post a Comment