Rawns Posted July 15, 2009 Posted July 15, 2009 I would like to put together a script that will delete a folder located on a server, and then run a scheduled task on the server. I'm unsure how to go about this. Any advise?
K.C.Leblanc Posted July 15, 2009 Posted July 15, 2009 deltree [path of folder] /S /Q Shove that in a file with the extension .bat and then add it to tasksheduler.
Rawns Posted July 15, 2009 Author Posted July 15, 2009 OK, I don't think I explained myself well enough. What I want to do is run a script on my PC that will connect to a server I choose and delete a specific folder on the S drive. I then want to run a scheduled task that is already in the servers task scheduler.
mac_shinobi Posted July 15, 2009 Posted July 15, 2009 deltree [path of folder] /S /Q Shove that in a file with the extension .bat and then add it to tasksheduler. When using that can you use a UNC path or does the UNC path have to have a drive letter assigned ? Also you may need to use WMI or WMIC ( depending on whether you are using command line ie a bat file or vbscript ) WMI for vbscript or WMIC for a bat script to do the remote stuff ( using the win32_process ) that should allow you to launch or execute remote processes to run the task scheduler on the server - not done this before so that would be a new one and with the WMI side you most likely will need to authenticate against the server using your login credentials
Pashers Posted July 15, 2009 Posted July 15, 2009 This is possible, have a look at psexec, you can create a batch file. Try something like the following: psexec \\computer -u localadmin -p password -i c:\program.exe
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now