myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


           



VBS Script Which calls psexec

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> VB Script >> VBS Script Which calls psexec Page: [1]
Login
Message << Older Topic   Newer Topic >>
VBS Script Which calls psexec - 5/6/2008 9:42:11 AM   
jbolton_99

 

Posts: 2
Score: 0
Joined: 7/31/2007
Status: offline
I have a script I found which will call the psexec program on a specified computer then uninstall and reinstall the SMS Client. I was hoping it could be modified too call from a list of computers from a txt file then export the results to another text file.

Right now it will work with the computers that I list in arrComputers =, but if its possible to grab the computer list from a txt file that would help me automate this process. In addition if I could look over the result file I could remove the systems from the list which successfully completed the process.

arrComputers = Array("Computer_Name")
Set objShell = CreateObject("WScript.Shell")
For Each strComputer In arrComputers
     objShell.Run "psexec \\" & strComputer & " -c ccmclean.exe /q", 1, True
     objShell.Run "psexec \\" & strComputer & " regedit.exe /s removeSMSkeys.reg"
     objShell.Run "psexec \\" & strComputer & " -c ccmsetup.exe SMSSITECODE=HQ1 SMSCACHESIZE=300 /q"
Next

Any help or suggestions would be appreciated. Thanks in advance!
Post #: 1
RE: VBS Script Which calls psexec - 5/6/2008 10:50:15 AM   
vrodrigues


Posts: 56
Score: 7
Joined: 6/8/2001
Status: offline
This should do the trick for inputing a machine list.


Option Explicit

Dim fso
Dim objShell
Dim strComputer
Dim inputFile

Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set inputFile = fso.OpenTextFile("Machine.Txt")

Do While Not (inputFile.atEndOfStream)
     strComputer = inputFile.ReadLine
     objShell.Run "psexec \\" & strComputer & " -c ccmclean.exe /q", 1, True
     objShell.Run "psexec \\" & strComputer & " regedit.exe /s removeSMSkeys.reg"
     objShell.Run "psexec \\" & strComputer & " -c ccmsetup.exe SMSSITECODE=HQ1 SMSCACHESIZE=300 /q"
Loop
inputFile.Close

< Message edited by vrodrigues -- 5/6/2008 11:50:35 AM >

(in reply to jbolton_99)
Post #: 2
Page:   [1]
All Forums >> [Scripting Technologies] >> VB Script >> VBS Script Which calls psexec 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




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.266