How to connect to servers on domain and run batch file


hi,

totally new here , new vb, hope i'm in right place ask help. i'm working on little script automate tasks across 12 servers, on same domain , have similar setup. tasks create new folder, copy contents off network it, , create virtual directory in iis 6 pointing it. ideally i'd log errors that's later concern. approach write vb script connect wmi on each server in array, use run off batch file. while vbs works if tell create folder directly, not run (any part of) batch file, nor give me errors. doing wrong?

the script:

on error resume next
'define servers connect to
arrcomputers = array("svrname1","svrname2","svrname3")
'call wmi on each server & use cmd make directory
for each strcomputer in arrcomputers
    set objwmiservice = getobject _
    ("winmgmts:\\" & strcomputer & "\root\cimv2:win32_process")
    errreturn = objwmiservice.create _
        ("cmd.exe /c j:\test1.bat", null, null, intprocessid)
    next

if change line ("cmd.exe /c md d:\testfolder\testxx", null, null, intprocessid) creates folder, know connects wmi , cmd ok, i'm stumped why refuses run batch file instead. j:\ network drive, mapped because think unc paths struggle in command prompt. contents of batch pretty simple, , when tried manually works fine. reason why wouldn't work when called via wmi?

md d:\testfolder\test02
net use i: \\mainsvr\teamshare\deploy\18776
xcopy i:\*.* d:\testfolder\test02 /e
xcopy d:\testfolder\test01\web.config d:\testfolder\test02
net use i: /delete
cd c:\windows\system32
cscript iisvdir.vbs /create "private website" testvirdir2 d:\testfolder\test02

i appreciate if advise, or point me in direction!

hi,

 

according problem description, issue related scripting. scripting related issue, best resource scripting forum. 

 

based on current situation, you’d better submit new question scripting forum further assistance. in way, issue can resolved effectively.

 

the official scripting guys forum!

http://social.technet.microsoft.com/forums/en/itcg/threads/

 

thanks understanding!

 

regards,


please remember click “mark answer” on post helps you, , click “unmark answer” if marked post not answer question. can beneficial other community members reading thread.


Windows Server  >  Management



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607