Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Determine if a User has Admin Rights

Keywords:   determine user admin rights

This script assumes that WinNT was installed on a NTFS partition and that the default directory/file permissions have not been altered.
;test for administrator rights
ErrorMode(@off)
a=FileOpen("C:\Winnt\System32\drivers\test.txt", "WRITE")
If a == 0
    Message("Attention!", "You do not have administrator rights to this machine. Installation will not continue.")
    exit
else
	FileWrite(a, "This is a test for administrator rights.")
	FileClose(a)
	FileDelete("C:\Winnt\System32\drivers\test.txt")
endif
ErrorMode(@cancel) 

Article ID:   W14628
Filename:   Determine if a User has Admin Rights.txt