I'm facing the following problem: In Windows AD every user logging in at a machine for the first time, shall get copied some program links on his desktop. Therefore desktop-pc and notebook are member of the AD and the desktops use serverbased-profiles while notebook use local profiles, it is necessary to differ the runonce-script.
My plan/script was the following one:
reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\explorer\Shell Folders" /v "Desktop" /f "R:\Profile\Desktop"
if %ERRORLEVEL% EQU 0 goto Domain
if %ERRORLEVEL% EQU 1 goto Notebook
:Domain
ECHO off
xcopy "c:\UserApps\Desktop-Verknuepfungen\*.lnk" "R:\Profile\Desktop\*.lnk" /Y > nul
exit
:Notebook
ECHO off
xcopy "c:\UserApps\Desktop-Verknuepfungen\*.lnk" "%USERPROFILE%\Desktop\*.lnk" /Y > nul
exit
The shell-folder desktop string should be examined if it's the ad-path or the local path to decide: desktop or notebook. Unfortunately in every case, although it is a notebook, the errorlevel 0 returns and the script uses the wrong jumplabel. Normally it should return for a local path errorlevel 1.
Maybe someone can help out?
Thank you so much in advice,
Chris