PowerShell

How to List Local Administrators Using PowerShell

Posted on

Try the below script, in order to audit or list local administrators. Here is the VBScript Set objGroup = GetObject(“WinNT://./Administrators,group”) For Each objUser In objGroup.Members WScript.Echo “Member found: ” & objUser.Name Next set objGroup = Nothing Here is the Powershell syntax function LogToFile ([string]$strFileName, [string]$strComputer) { Add-Content $strFileName $strComputer } $strComputer = “.” $computer = […]