script for remote moving & sharing

I have a small task in my migration project to move data from restored location to orignal & then share the

folder with name user$ & everyone has change ,Read permission on the share.

I have kept the script very simple (not used VBscript )-just simple commands executed remotely with the help of psexec

Save the following line in a batch file:

psexec \\server4 cmd.exe /c move G:\Restore\Users\%1 G:\Users\%1

psexec \\server4 cmd.exe /c move F:\Restore\Profiles\%1 F:\Profiles\%1
psexec \\server4 cmd.exe /c “net share %1$=g:\users\%1 /GRANT:Everyone,CHANGE”
This script will excute simply putting  script.bat userid & it will do below activities:

1. move G:\Restore\Users\userid to  G:\Users\userid folder

2. move F:\Restore\Profiles\userid to F:\Profiles\userid folder

3.  Create a sharename userid$ & give everyone Read,Change permission on the share.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s