Link to home
Start Free TrialLog in
Avatar of Mike
MikeFlag for United States of America

asked on

Need help creating PowerShell script

Greeting experts

I need help creating a PowerShell script to get a list of local administrators from a list of computers. Can somebody help set up a PowerShell script to read from a list of servers from the .txt file, prompt for Domain Creds, scan each device in the list for local admin, then put the data into a .csv file. Can somebody help me with this task.... 
Avatar of oBdA

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike


When I attempt to run the script I get the following message:

Connecting to remote server failed with the following
error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that
the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled
and allows access from this computer. By default, the WinRM firewall exception for public profiles limits
access to remote computers within the same local subnet. For more information, see the
about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: ( :String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionStateBroken
Avatar of oBdA

Which OSs are the target systems running? Remote PS should be enabled by default on Server 2016 and later.
As the error message suggests, start here:
Get-Help about_Remote_Troubleshooting 

Open in new window