Adding a user through vbscript

F

Fyodor Koryazhkin

Hi,
I am trying to add a domain memeber to a local group but my script fails
with the following error:
"General access denied error
Code: 80070005
Source: Active Directory"

The script I am running is:
computername = computer
ServerName = domain
User_Name = user
set IIS_WPG = GetObject("WinNT://" & computername & "/IIS_WPG,group")
set MyUser = GetObject("WinNT://" & ServerName & "/" & User_Name & ",user")
if not IIS_WPG.IsMember(MyUser.AdsPath) then
IIS_WPG.Add(MyUser.AdsPath)
End if

The script fails on the line IIS_WPG.Add(MyUser.AdsPath).

If I run the same script trying to add a local user, it passes OK.

Where can be a problem?

Thank you.

Fyodor.
 
Z

Zack Whittaker

What OS are you running... and if you're running Longhorn Server or Vista,
make sure you're logged in as a Domain Admin and not the local
Administrator.

--
Zack Whittaker
» ZackNET Enterprises: www.zacknet.co.uk
» MSBlog on ResDev: www.msblog.org
» Vista Knowledge Base: www.vistabase.co.uk
» This mailing is provided "as is" with no warranties, and confers no
rights. All opinions expressed are those of myself unless stated so, and not
of my employer, best friend, Ghandi, my mother or my cat. Glad we cleared
that up!

--: Original message follows :--
 
F

Fyodor Koryazhkin

Hello Zack,
I am running Vista build 5308.
From your post I understand that to add a domain user to local group I need
to be a Domain Admin. Is it true?
Does behavior differ from XP where I can add a domain user to local group?

thank you.
 
Z

Zack Whittaker

It should be exactly the same as XP - try making sure that UAP/UAC is
disabled though as this can cause problems sometimes.
http://www.vistabase.co.uk/welcome.php?subcats/security/disableuap

--
Zack Whittaker
» ZackNET Enterprises: www.zacknet.co.uk
» MSBlog on ResDev: www.msblog.org
» Vista Knowledge Base: www.vistabase.co.uk
» This mailing is provided "as is" with no warranties, and confers no
rights. All opinions expressed are those of myself unless stated so, and not
of my employer, best friend, Ghandi, my mother or my cat. Glad we cleared
that up!

--: Original message follows :--
 
F

Fyodor Koryazhkin

Hello Zack,
Thanks, it worked!
One more question: is there any possibility to avoid switching UAP\UAC off?
We cannot make a user to switch it on/off every time. Where can I find an
information about this feature? Is this feature introduced in Vista for the
first time?

Thank you,
Fyodor.
 
Z

Zack Whittaker

It's a computer setting rather than a per-user settings I believe. I've
written some articles on it, they've got some links at the bottom if they
help.
http://www.vistabase.co.uk/welcome.php?subcats/security/whatisuap
http://www.vistabase.co.uk/welcome.php?subcats/security/disableuap
http://www.microsoft.com/technet/windowsvista/evaluate/feat/uaprot.mspx

--
Zack Whittaker
» ZackNET Enterprises: www.zacknet.co.uk
» MSBlog on ResDev: www.msblog.org
» Vista Knowledge Base: www.vistabase.co.uk
» This mailing is provided "as is" with no warranties, and confers no
rights. All opinions expressed are those of myself unless stated so, and not
of my employer, best friend, Ghandi, my mother or my cat. Glad we cleared
that up!

--: Original message follows :--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top