Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Difficulties with the function call

$
0
0

Hi guys!

I am sorry formy english

there is a function:

# Script:    Get-Remote-LocalAdmins.ps1
# Purpose:  This script can detect the members of a remote machine's local Admins group
# Author:   Paperclips (The Dark Lord)
# Email:    magiconion_M@hotmail.com
# Date:     Nov 2011
# Comments:
# Notes:    
#            

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

#Usage: get-localadmin "Server FQDN"


Functionis in the fileGet-Remote-Localadmin.ps1.I aminsertitinto the profile.I opena new session
andtry to runas specifiedin the comment get-localadmin "Server FQDN" (get-localadminW7-ps.contoso.com)

andget nothing at the output


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>