We have a small environment where we are setting up mountable drives using a login.bat file, reason why we are doing this because our script first tests whether the folder is created for that user, and then if so makes a folder, then finally it mounts the drive.

Our issue is when we logon the script fails because it runs "net use" as an administrative account as this is default with UAC enabled. We investigated and found launchapp.wsf and information on Microsoft sites about this however these scripts are poorly written and have errors on the code.

We do not want to disable UAC and compromise security and we want to use a script because we want to test whether the folder exists, thus we cannot use GPO to mount a drive.

@echo off
net use h: /delete /yes
if not exist "\\domain.com\user\%username% mkdir "\\domain.com\user\%username%"
net use h: "\\domain.com\user\%username%
label h: HOME

TLDR: How do we make computers with UAC mount a drive through a login script as the local user rather than admin, what launchapp.wsf script variants worked for you?

  • To the best of my limited knowledge in PowerShell, I'm quite certain that you can achieve the same thing with it, while incorporating it in a correct way of performing various settings - GPO. In no way it will threaten security, quite a contrary. Today you achieve almost everything with it. – Vick Vega Mar 23 '16 at 0:19
  • You can get around this by enabling the EnableLinkedConnections registry value. – Bill_Stewart Jul 21 '16 at 3:08

This is what mine is (stored in \DomainController\SYSVOL\domain.local\scripts) Then, in the AD Users > Properties > Profile > Logon Script > login.bat This script adds Q R X P U and S volumes.

@Echo OFF

ECHO "Please Wait..."

REM net use /d Q:
NET USE Q: >nul
IF %ERRORLEVEL% NEQ 0 (net use q: \\hqfile01\Q)

REM net use /d R:
NET USE R: >nul
IF %ERRORLEVEL% NEQ 0 (net use R: \\hqfile02\Downloads)

REM net use /d X:
NET USE X: >nul
IF %ERRORLEVEL% NEQ 0 (net use X: \\hqfile01\Audio)

REM net use /d P:
NET USE P: >nul
IF %ERRORLEVEL% NEQ 0 (net use P: "\\hqfile02\CopierStore\%username%")

REM net use /d U:
NET USE U: >nul
IF %ERRORLEVEL% NEQ 0 (net use U: "\\hqfile01\Users\%username%")

REM net use /d S:
NET USE S: >nul
IF %ERRORLEVEL% NEQ 0 (net use S: \\hqfile02\Scratch)


None of my users are admins and UAC is on. This works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.