Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

schtasks.exe /create

Status
Not open for further replies.

sotghalz

Technical User
Apr 11, 2007
57
US
I have a list of computers in wslist.txt and after the first computer every other computer gets a different logon account then identified in the vbs. Here is what I have so far:

Code:
Dim ru, rp

ru = "domain\account"
rp = "password"

Set WshShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
For Each strComputer In Split(oFSO.OpenTextFile("wslist.txt").ReadAll, vbNewLine)
	WshShell.Run "schtasks.exe /create /s \\" & strcomputer & " /tn CleanUp1 /tr \\Path\cleanup.vbs /sc monthly /st 02:00:00 /ru " & ru & " /rp " & rp & ""
	WshShell.Run "schtasks.exe /create /s \\" & strComputer & " /tn Defrag1 /tr \\path\defrag.vbs /sc monthly /st 04:00:00 /ru " & ru & " /rp " & rp & ""
Next

Thanks for your help.
 
youre going to have to add the username/password combinations into the answer file. Maybe comma separated..then do a split to determine the values for the username/password variables so that it is dynamic.

Only problem is, this method is going to send the username and password combo in clear text across the line unless you are using IPSec....

- Brandon Wilson
MCSE:Security00/03; MCSA:Security03
MCSA:Messaging00; MCP; A+
IT Pangaea (
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top