I apprecaite the post. I was really wanting to know about the permissions to be able to delete the all users\desktop file...

Here is the logic I was going to use...
 Code:
$CompName = @HOSTNAME

SELECT
	CASE InStr($CompName,"TNHQ")
		; Do nothing, but tell them why.
		? "    EMR Icon is not installed on Corporate computers."
	CASE EXIST("%USERPROFILE%\desktop\EMR2.RDP")=1 OR EXIST("%ALLUSERSPROFILE%\desktop\EMR2.RDP")=1
		; Do nothing, but tell them why...
		? "    EMR Icon already exists on your desktop."
	CASE EXIST("%USERPROFILE%\desktop\EMR.RDP")=1 OR EXIST("%ALLUSERSPROFILE%\desktop\EMR.RDP")=1
		? "    I am deleting link to EMR1 from your desktop."
		IF EXIST("%USERPROFILE%\desktop\EMR.RDP")=1
			DEL "%USERPROFILE%\desktop\EMR.RDP"
			CALL "errortrap.kix"
		ENDIF
		IF EXIST("%ALLUSERSPROFILE%\desktop\EMR.RDP")=1
			DEL "%ALLUSERSPROFILE%\desktop\EMR.RDP"
			CALL "errortrap.kix"
		ENDIF
		? "    I am copying the EMR2 Icon to your desktop."
		COPY "\\$dc-dc1\netlogon\EMR2.RDP" "%USERPROFILE%\desktop\EMR2.RDP"
		CALL "errortrap.kix"
	CASE 1
		; Copy the .rdp file from the local DC to the local user's desktop.
		? "    I am copying the EMR2 Icon to your desktop."
		COPY "\\$dc-dc1\netlogon\EMR2.RDP" "%USERPROFILE%\desktop\EMR2.RDP"
		CALL "errortrap.kix"
ENDSELECT

I just know for a fact that the DEL "%ALLUSERSPROFILE%\desktop\EMR.RDP" will fail because of permissions. I just wanted to know how to get around that, perhaps by calling the script with administrative access.


Edited by DrUltima (2007-05-07 10:44 PM)
Edit Reason: Added code