Drive mappings not working correctly
The net use x: \\servername\%username%$ gives a System error 53 has occurred, network path was not found
Is there a different variable name for %username% in Windows 7 compared to XP?
The \\server\netlogon\ifmember is not recognized as an internal or external command, System error 85 has occurred
Is there a Windows 7 command similar to XP or is there a completely different way to do this within Windows 7?
Thanks
July 23rd, 2011 8:52am
I believe the problem you are having is with the resolution of your server name and so since it can't find the server it can't run the operation.
From a command prompt on the client, type: Net View
\\server and see if it returns resources, if it doesn't then try: Net View
\\fqdn of server (for example: server.domain.com).
If you don't see resources in the first example but do in the second, then a WINS server will resolve it for you.
Dave
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2011 1:52pm
Hello,
Have drive mappings set in Group Policy and if a user belongs to a certain AD group they are mapped correctly.
If the user accidentally removes the drives or connecting via VPN have the below script that works in XP but doesn't work in Windows 7?
:Begin
CLS
REM The Following deletes all existing drive mappings
net use * /delete /yes
echo drives deleted
net use x: \\server\%USERNAME%$
net use y: \\server\FILES
net use z: \\server\APPS
REM Checks for group membership
%logonserver%\netlogon\ifmember "Domain\Sales"
if not errorlevel 1 goto 2
net use w: \\server\sales
:2
%logonserver%\netlogon\ifmember "Domain\accounting"
if not errorlevel 1 goto 3
net use w: \\server\ACCOUNTING
:3
%logonserver%\netlogon\ifmember "domain\admins"
if not errorlevel 1 goto 4
net use w: \\server\admins
:4
end
It maps the FILE (Y) and APPS (Z) but not the X (User) and W (dept) drives?
Any recommendations would be great to get this fixed!
July 23rd, 2011 4:14pm
Logon scripts and UAC don't play well together. You may want to turn it off an see if they map OK
Or you can check Microsoft's preferred workaround described here
http://technet.microsoft.com/en-us/library/cc766208%28WS.10%29.aspx
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2011 6:04pm
I would log in as a user and try running the script from the command prompt so you can view any errors. this should help you troubleshoot the issues.
Dave
July 23rd, 2011 9:05pm
Why do you add a “$” in the command? How does it work if you remove it?Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
July 26th, 2011 4:44am
Why do you add a “$” in the command? How does it work if you remove it?
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
The $ is needed because TorkerTrike is using hiden shares as personal folders.
Dave
July 27th, 2011 2:46pm
Correct, $ is needed for hidden shares.
The FQN helped and we found that there was a wrong FW entry and that corrected the issue too.
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2011 3:39pm
Found the hard way that IFMEMBER doesn't work in Windows 7 %logonserver%\netlogon\ifmember "Domain\Sales"
To fix this using the below syntax
Net user /domain %username% | find "Sales Group"
If not errorlevel 1 goto 2
Net use X: \\Share.Server.com\Sales
:2
Net user /domain %username% | find "Marketing Group"
If not errorlevel 1 goto 3
Net use X: \\Share.Server.com\Marketing
:3
Net user /domain %username% | find "Golf Group"
If not errorlevel 1 goto 4
Net use X: \\Share.Server.com\Golf
:4
If I have a Marketing user when the script runs it will map X: for SALES since it is the first one in the script and not GOTO :2 and map X: Marketing
How can I get the logic to work for the user that belong to the proper department?
Thanks
August 6th, 2011 2:38pm
unfortunately the Net User command you have is always returning error level 1 so it is running each Net Use command. you can check the errorlevel by adding some code like this to your batch file.
if errorlevel 0 set errorlev=0
if errorlevel 1 set errorlev=1
if errorlevel 2 set errorlev=2
if errorlevel 3 set errorlev=3
if errorlevel 4 set errorlev=4
Echo errorlevel = %errorlev%
pause
I'll look for other ways to determine group membership and let you know.
Dave
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2011 2:59pm
You need to add the /I to each of these commands to get an error level 0 when successful.
Net user /domain %username% | find /I "Sales Group"
Then you need to add a GOTO end after the NET USE line in case they are in more than one group.
Dave
August 6th, 2011 3:17pm
Thank you Dave.
added the /I and GOTO end yet still gives me the first mapping of Sales instead of Marketing?
Net user /domain %username% | find /I "Sales Group"
If not errorlevel 1 goto 2
Net use X: \\Share.Server.com\Sales
Goto End
:2
Net user /domain %username% | find /I "Marketing Group"
If not errorlevel 1 goto 3
Net use X: \\Share.Server.com\Marketing
Goto End
:3
Net user /domain %username% | find /I "Golf Group"
If not errorlevel 1 goto 4
Net use X: \\Share.Server.com\Golf
Goto End
:4
:END
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2011 4:00pm
Silly me I missed the method you are checking. If the Net User command is successful, it will return a 0, if it is not successful, it will return errorlevel 1. So remove the
not in each of these "If not errorlevel 1 goto x" and you should get the logic you need.
:-)
Dave
August 6th, 2011 6:20pm