View Single Post
Old 08-08-2007   #6 (permalink)
Thomas M.


 
 

Re: Add User to AD Group


"Marco Shaw" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:e02EHEW2HHA.1208@TK2MSFTNGP03.phx.gbl...
> Thomas M. wrote:
>> I'm new to PowerShell and I'm trying to create a script that will add a
>> user to an Active Directory group. I copied the following code out of a
>> book into PrimalScript 4.1 Enterprise and modified it for my environment.
>> I've sanitized the code (force of habit when posting on the Internet).

>
>>
>> <Path>\AddUserToGroup.vbs(3, 1) (null): There is no such object on
>> the server.
>> Exit code: 0 , 0000h
>>
>> where <Path> is the full path to the script file.
>>
>> Can someone show me what I am doing wrong?

>
> I'm sorry, everything you mention is pointing to VBScript (including the
> .vbs extension of the file you're running).
>
> You're looking to make your existing VBScript run or want some help
> porting it to PowerShell.
>
> PowerShell's 'scripting engine' is very different from VBScript, and
> PowerShell scripts are normally saved with a .ps1 extension.
>
> Marco


Yeah. I had both my PowerShell and my book on ADSI out and I cited the
wrong book by mistake. I'm green when it comes to scripting, but not that
green! It was just a silly oversight on my part. I apologize for the
confusion.

It is written in VBScript and I'm running it in PrimalScript 4.1 Enterprise.
When I looked at the book last night I was under the impression that the
section of code given was complete, but looking at it again this morning it
looks like the example given may assume that other things have been done
first. I skimmed the book last night to see if that was the case, but
perhaps I missed something. I will go back a review it more closely.

Brandon also posted a link to an article so I will review that as well.
Let's consider this one closed. If after digging into it a bit more I still
have questions, I will post a new message.

Thanks for your help!

--Tom


My System SpecsSystem Spec