ChiefIT
asked on
access denied for users to run Net Use within a batch file to initiate logon scripts.
I have some small scripts that delete all mapped drives and recreate the mapped drives using the Net Use command.
Net Use * \Delete /yes
Net Use \\computer\share /yes
These run fine for the administrator, but not the user
Also, the users each have another mapped network drive that is used for their home folder. This has been created using their active directory profile. I don't want to delete that folder.
Can anyone help me come up with a good way of doing this?
I stink at creating these batch files and scripts.
Net Use * \Delete /yes
Net Use \\computer\share /yes
These run fine for the administrator, but not the user
Also, the users each have another mapped network drive that is used for their home folder. This has been created using their active directory profile. I don't want to delete that folder.
Can anyone help me come up with a good way of doing this?
I stink at creating these batch files and scripts.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ps their home folder mapping will be recreated since you have defined it in AD profile.
ASKER
The net use command is the way I was doing things before. They all of a sudden quit working.
So, I went into Joe.Testuser account to watch the command window and found they were getting access denied. Then, I went to the command prompt and tried to manually run net use .... from there with access denied. I think it safe to assume, if you are not the domain or local admin net use is denied from running. That leads me to believe that net use is not the way to go any more.
I do like the above VB sript and would like a bit more info on what it does.. I have up to ten drives to map on some users.
So, I went into Joe.Testuser account to watch the command window and found they were getting access denied. Then, I went to the command prompt and tried to manually run net use .... from there with access denied. I think it safe to assume, if you are not the domain or local admin net use is denied from running. That leads me to believe that net use is not the way to go any more.
I do like the above VB sript and would like a bit more info on what it does.. I have up to ten drives to map on some users.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For some folks the net use command might work. I am going to switch to VB scripts and start learning these. So, I really do appreciate the help on netuse that was offered above, but I found the help on the VB script more up my alley.
Well done dstwrtjr:
Well done dstwrtjr:
I like this way better(VBS)
'Disconnect ALL mapped drives
dim WshNetwork
Set WshNetwork = CreateObject("WScript.Netw
Set clDrives = WshNetwork.EnumNetworkDriv
For i = 0 to clDrives.Count -1 Step 2
WSHNetwork.RemoveNetworkDr
Next
'Map the Drive
WshNetwork.MapNetworkDrive