PowerShell Script to get Admin group members in Server 2008 R2.
hi...i admin group members in multiple server 2008 r2 using powershell script that's mentioned below. working fine in server 2012
$output = 'c:\temp\result.txt' $servers= get-content 'c:\temp\servernames.txt' $scriptblock = { $groups = get-wmiobject win32_groupuser -computername $using:servername $localadmins = $groups | groupcomponent –like '*"administrators"' $localadmins | foreach-object { if($_.partcomponent –match ".+domain\=(.+)\,name\=(.+)$"){ $matches[1].trim('"') + "\" + $matches[2].trim('"') } } } foreach ($servername in $servers) { # 1. local administrators group members "local admin group members in $servername" | out-file $output -append invoke-command -scriptblock $scriptblock -computername $servername | out-file $output -append # 2. local user information write-output "local user information" | out-file $output -append get-wmiobject -class win32_useraccount -computername $servers -namespace "root\cimv2" -filter "localaccount='true'" | out-file $output -append }
but when run in server 2008 r2, getting error mentioned below, checked if windows remote management (ws-management) running , running. ran winrm quick config...
any other suggestions suggest script connect multiple remote server 2008 r2 servers.
connecting remote server failed following error message : client cannot connect destination specified in request. verify service on destination running , accepting requests. consult logs , documentation ws-management service running on destination, commonly iis or winrm. if destination winrm service, run following command on destination analyze , configure thewinrm service: "winrm quickconfig". more information, see about_remote_troubleshooting topic. + categoryinfo : openerror: (:) [], psremotingtransportexception + fullyqualifiederrorid : pssessionstatebroken
pls let me know.
vt
you have fix or enable remoting on 2008 server.
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment