Without knowing the contents of $Domain or $useradm, it's practically 
impossible to guess.

If you assume that

                $Domain = 'example'

And that

                $useradm = 'example\michael'

Then what that line is attempting to do is strip off "example\" in front of 
$useradm, and then add the user to the group identified by $adsi.

                $adsi.Add( "WinNT://example/michael,group" )

The error says that "michael" doesn't exist as a domain user in the "example" 
domain.

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Lutz, Ken
Sent: Monday, November 17, 2014 2:26 PM
To: 'powershell@lists.myITforum.com'
Subject: [powershell] ADSI help

I'm using the two scripts from this web site 
(http://thedesktopteam.com/blog/raphael/local-administrators-group-and-compliance-settings/)
 to verify and update membership of a local group on my workstations.

In the second script is this command:

$adsi.Add("WinNT://$Domain/" + ($useradm -Replace ("$($Domain)\\","")) + 
",group")

When I run the script I get this error, and I have no idea as to what the issue 
is.  I am running this from an 'Administrative' level PowerShell session.  At 
this point I'm just trying to verify that the script is doing what I want it to 
do before I go to SCCM and setup the Compliance stuff.  What am I missing, or 
have wrong?

$Domain has a valid value, and $useradm is also valid, in this format <domain 
name>\<user name>     $members is also a valid list of 3 users in the same 
format as $useradm.

[cid:image002.png@01D00278.16C0A780]



Thanks!

Ken Lutz
Senior Systems Administrator
Information Systems Department
Spokane County
815 N. Jefferson
Spokane, Washington  99260
[cid:image003.png@01D00278.16C0A780]



================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to