Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Where are you VBS Wizards??(question)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2747
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Where are you VBS Wizards??(question)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Where are you VBS Wizards??(question) - 4/20/2005 1:23:45 AM   
  killr0y

 

Posts: 37
Score: 0
Joined: 3/7/2005
From:
Status: offline
Anyone want to help me write a script that looks in a particular OU for machines, then scans the machine for a specific local admin account (we'll call it lcladmin), and change its password?

Ideas?

Danke!
 
 
Post #: 1
 
 Re: Where are you VBS Wizards??(question) - 4/20/2005 1:36:26 AM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
At the end of this article, the Scripting Guy's handle your question.

HTH

(in reply to killr0y)
 
 
Post #: 2
 
 Re: Where are you VBS Wizards??(question) - 4/20/2005 6:54:07 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
What do you have so far ?

(in reply to killr0y)
 
 
Post #: 3
 
 Re: Where are you VBS Wizards??(question) - 4/20/2005 9:50:41 PM   
  killr0y

 

Posts: 37
Score: 0
Joined: 3/7/2005
From:
Status: offline
quote:
Originally posted by token

What do you have so far ?




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

For Each objItem in objOU
'On Error Resume Next
strComputer = objItem.CN
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword("i5A2sj*!")
Next

Ok a couple questions:

1) how can I log the changes to a text file, and have it check that log file to determine which computers need to be updated so I can run the script again on a later date. (not all PC's in AD are going to be online all the time)

2) I have that "on error resume next" in there temporarily so I can run the script and not have it error out when it hits a PC that is in AD but not online, but it will need to be removed/changed to log the unsuccessful ones.

Thanks!

(in reply to killr0y)
 
 
Post #: 4
 
 Re: Where are you VBS Wizards??(question) - 4/20/2005 11:46:23 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Why not use ping to determine if the PC is online or not, do a search here and you will find scripts that do this. Then, if ping returns that the PC is offline, you can write the PC name to a file, again there are examples on the site and good examples in the WSH docs.

(in reply to killr0y)
 
 
Post #: 5
 
 Re: Where are you VBS Wizards??(question) - 4/21/2005 1:15:47 AM   
  killr0y

 

Posts: 37
Score: 0
Joined: 3/7/2005
From:
Status: offline
quote:
Originally posted by mbouchard

Why not use ping to determine if the PC is online or not, do a search here and you will find scripts that do this. Then, if ping returns that the PC is offline, you can write the PC name to a file, again there are examples on the site and good examples in the WSH docs.



What I'd really like to do is have the script poll all the machines and build a list of PC's that are active, then have a UI where you can highlight all the machines you want to run the script on, but I am guessing this can only be done in a full-blown VB app.. :(

(in reply to killr0y)
 
 
Post #: 6
 
 Re: Where are you VBS Wizards??(question) - 4/21/2005 11:21:14 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
As far as I can see, you have 2 choices (for now).

1. You ping all the clients ahead of time and contruct the list of clients that are online. This will be used on a session by sessiono basis; meaning that each time you execute the script, it will get a list of currently online clients only for you to work on.

2. You get a list of ALL clients whether they are online or not. When you manually select a client, it will then determine its online/offline status on demand.

(in reply to killr0y)
 
 
Post #: 7
 
 Re: Where are you VBS Wizards??(question) - 4/21/2005 10:51:40 PM   
  killr0y

 

Posts: 37
Score: 0
Joined: 3/7/2005
From:
Status: offline
any idea of how to integrate a ping into this script?

(in reply to killr0y)
 
 
Post #: 8
 
 Re: Where are you VBS Wizards??(question) - 4/21/2005 11:02:45 PM   
  crazymatt

 

Posts: 296
Score: 0
Joined: 3/4/2005
From:
Status: offline
You would prolly found this searching the forum but here is it anyway :)
Remeber this only works on XP or later. If u have older machines you must ping them by calling the external program ping.exe and read the output from ping to see if its succesful or not.

--------
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PingStatus " & _
"Where Address = '" & strComputer & "'")
For Each objItem in colItems
If objItem.StatusCode = 0 Then
WScript.Echo "Host Alive"
Else
Wscript.Echo "Host unreachable"
End If
Next
------

/CM

(in reply to killr0y)
 
 
Post #: 9
 
 Re: Where are you VBS Wizards??(question) - 4/21/2005 11:48:29 PM   
  killr0y

 

Posts: 37
Score: 0
Joined: 3/7/2005
From:
Status: offline
Actually, I found the ping code on here. My question was how to actually integrate it into the password change script. I'm not even at the novice level of wsh so that's why I need so much help!

(in reply to killr0y)
 
 
Post #: 10
 
 Re: Where are you VBS Wizards??(question) - 4/22/2005 1:49:47 AM   
  jovius98

 

Posts: 17
Score: 0
Joined: 4/19/2005
From:
Status: offline
This is what I suggest - it doesn't do the ping, but it does log success / failure so only failed updates are attempted on subsequent runs:


      

(in reply to killr0y)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Where are you VBS Wizards??(question) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts