Jump to content

Recommended Posts

Posted

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?

Posted

OK, I don't think I explained myself well enough. :p

 

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.

Posted
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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...