Creating a script
Hello all,
Maybe I haven't understood the scripting very well, that's why I am asking for help. I am trying to create a very simple script in which I map a network drive and I want to apply it to a test virtual machine.
I have created a batch file with the necessary command and I went to Scripting, Scripts, Add New Item and I selected to create an Offline script with name "Map Drive" , Status "Example" , I enabled it , I deploy it to a specific machine , I select the OS , I select "Do not run on a schedule" and I have checked the "Also run at user log in".
When I save it I run it immediately and in Run now status I see that 1 script is pushed succesfully and one script is completed succesfully. I forgot to mention that I have uploaded the bat file in Dependencies.
But after this, when I go to log in from the test computer, I see nothing.
When I go back to the script and check the Scheduling, except the "Also run at user logon" which I have it selected, I see also checked the "Allow run while logged off".
What do I do wrong?
Thank you!!!
Answers (3)
You could do the same hting through the enforce regsitry settings wizard
Like the following registry entry.
This code will add a persistent mapping for “L” drive into the registry.
[HKEY_CURRENT_USER\Network\L]
“RemotePath”=”\\\\MyServerName\\MyMappedFolder”
“UserName”=dword:00000000
“ProviderName”=”Microsoft Windows Network”
“ProviderType”=dword:00020000
“ConnectionType”=dword:00000001
“DeferFlags”=dword:00000004
OK, I changed it to online but now, in the Scheduling area I don't have any "run at user log in". And I need this to be run at user log in, or I want somehow the settings to stay permanenlty. I cannot use the scheduling because I don't know when a user logs in.
Comments:
-
Are you using NET USE in your bat? If you want the mapping to stay use /Persistent:Yes. - dugullett 11 years ago
-
are all these machines in the same domain. If so create a ad group and add a line to the login script if user is member of group map the drive. If everyone who uses a machine will need this mapping you can also use an offline script to push a run command to the registry HKLM\software\microsoft\windows\currentversion\run - SMal.tmcc 11 years ago
-
to push a reg change
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v mapxdrive /d "net use x: \\server\share" - SMal.tmcc 11 years ago
-
Sorry for my delayed answer. Yes I am using the NET USE command and I also use the /Persistent:yes
All the machines are in the same domain and I am trying to test with a machine which actually belongs to me (domain admin). All the users are using their own computers and nobody else is working on them.
Still doesn't work. (SMal.tmcc I didn't follow your advice. Isn't there any other seasier way to do it?)
Thank you all! - elvenil 11 years ago-
add the net use line to the domain login.bat file - SMal.tmcc 11 years ago