Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Calling of the Powershell functions

$
0
0

Hi,

While I am calling the function:

function get-localadmin { 
param ($strcomputer) 
 
$admins = Gwmi win32_groupuser –computer $strcomputer  
$admins = $admins |? {$_.groupcomponent –like '*"Administrators"'} 
 
$admins |% { 
$_.partcomponent –match “.+Domain\=(.+)\,Name\=(.+)$” > $nul 
$matches[1].trim('"') + “\” + $matches[2].trim('"') 

}




 I get the following error:The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"
On the remote computer ( win 7)
The following services are running
RemoteAccess Autoconnection manager
RemoteAccess Connection manager
Remote procedure Call ( RPC )
Remote procedure Call ( RPC ) Locator
Remote Registry

For DCOM there is Registry setting
Key: HKLM\Software\Microsoft\OLE, value: EnableDCOM: Y

On the firewall Windows Management Instrumentation ( WMI-In) rule is enabled

When I turn off the firewall, I get the correct result. when returning the firewall turn on again get the same error.

Help me please


Viewing all articles
Browse latest Browse all 6937

Trending Articles