I am very, very new to VBScripts, but I am trying to delete a file from the local workstation and copy a new file from a network drive to the local machine. The problem I face is with rights; the file I need to delete is in c:\documents and settings\all users\start menu\programs, and users in my org don't have the ability to delete from or copy to this directory. The following is what I am trying to do in .bat form but again, I am very light on knowledge when it comes to scripting of this sort:
del "C:\Documents and Settings\All Users\Start Menu\Programs\PROGRAMXXX.lnk" copy "\\SERVERYYY\PROGRAMZZZ.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs" /Y
Once again, this must be done as domain admin due to the rights on the share and local machines. Any help would be appreciated greatly. Thanks.
the problem come from netbios , gpo rights or acl's ? differents solutions could come pending it.
at any case , try psexec from sysinternals , you can call it from a bat script or vbs too , with this tool you can execute on local or remote machines with the desired rights , also you can try with runas.exe.
Actually, I was hoping to be able to do this with a VB script. I don't want to use runas due to the cleartext displaying of any passwords, and although I have used programs in the past to encrypt the contents of the script, I would rather not go down that route with this. So, can this copy be done with a VB script?
To delete as and admin you must provide the credentials of an admin. So regardless of the method you use you must put the username and password somewhere.