473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Executing script to change local admin password

I have the following VBScript which I can execute from my workstation (I am a domain admin), in order to change the local computer's administrator password. However, I am noticing an oddity.

First, the script:
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Set objOU = GetObject("LDAP://OU=test, DC=mycompany, DC=com")
objOU.Filter = Array("Computer")

For Each objItem in objOU
strComputer = objItem.CN
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword("InsertPasswordHere")
Next

~~~~~~~~~~~~~~~~~~~~~~~

Now, I created the test OU last week, and I can run this script on it today just fine.

Today, about and hour and a half ago, I created another OU called Test2. I run the same script, with Test2 as the OU.. and the following error comes up:

___________________________
---------------------------
Windows Script Host
---------------------------
Script: D:\Documents and Settings\brianw\Desktop\Copy of Change Local Admin Password.vbs
Line: 6
Char: 5
Error: The network path was not found.
Code: 80070035
Source: (null)

---------------------------
OK
---------------------------

Now, the only difference between these two OUs is that one was created last week, the other less than two hours ago. Is there some replication issue that could be going on here that I'm not aware of? I can't see why this error would occur for one OU but not the one right next to it, when they are named properly in the script.
Mar 18 '08 #1
1 3499
Now, the only difference between these two OUs is that one was created last week, the other less than two hours ago. Is there some replication issue that could be going on here that I'm not aware of? I can't see why this error would occur for one OU but not the one right next to it, when they are named properly in the script.
Now I believe I have identified the problem. I tested several more times, and the error occurs when one or more of the computers whose objects are in the OU are *not* turned on.

Test 1: I created the OU, moved my PC's object into it. Script ran successfully.
Test 2: I moved a second PC object into that OU, said PC being active at the time. Script ran successfully.
Test 3: I shut down the second PC. Then ran the script: the script failed as per above.

So my question becomes - what do I need to adjust to make this script work if some of the Computer objects in the OU aren't necessarily turned on at the time? I'm aware they would not have their password changed, but this seems to prevent the script from functioning at all.
Mar 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: D E | last post by:
When using my web application manager (http://localhost:8080/admin) I forgot my password. Is there an XML file i can look at to remember/obtain (possibly even set). Thanks
1
by: Bryan Russell | last post by:
I've taken over an access database and was provided the admin password. My first task is to change the admin password, but my problem is that the 'Tools' menu has been removed to access the...
2
by: lauren quantrell | last post by:
Ok, so maybe this is way off the wall...and I realize this is more of a MS Windows question than an Access question, but here goes... Is there a way to grant an Access application itself admin...
2
by: news.microsoft.com | last post by:
I am looking for a way to allow the currently logged in user to change his/her password. Is there an API I can interop to in c#? Tia!
4
by: Daniel | last post by:
Can someone please describe why impersonation requires the impersonator to be local admin?
5
by: TravisTurman | last post by:
I'm a C# newbie and have inherited a program that runs at login. Part of the program looks at a text file to see which version is installed and then installs the latest greatest version if needed....
4
by: shashank kadge | last post by:
hi all, i am trying to get local admin users and groups on a windows server. here is the C# code that i am using...
6
by: ckc | last post by:
Hi, I have an issue where users require local administrator access on the pc to be able to run a particular program. However I do not want these users to have local admin access on their pc's. I...
3
by: Bennettwilliams | last post by:
Hi, how do i change the admin password in Mac OS X? I've read all the tutorials on the internet, but i dont have the instalation disk. Is there any other way to change the admin password? If...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.