Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
:CheckLocalAdmin RegOpenFlags(2) LocalAdmin=@TRUE Admin="0" ErrorMode(@Off) RegSetValue(@REGMACHINE,"System\CurrentControlSet\Control[Admin]","1") Admin=RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Control[Admin]") RegDelValue(@REGMACHINE,"System\CurrentControlSet\Control[Admin]") ErrorMode(@Cancel) If Admin!="1" LocalAdmin=@FALSE endif Return
For example, HKEY_LOCAL_MACHINE only grants KEY_WRITE to administrators and SYSTEM Accounts. An application that requests KEY_WRITE to HKEY_LOCAL_MACHINE will not work with UAC enabled. Reference: http://msdn2.microsoft.com/en-us/library/aa480150.aspx I am not sure you will be able to use that script to determine Administrative privileges any longer. I was able to get the RegSetValue to work if I included a manifest with the Requested Execution Level of 'RequireAdministrator'. However the script will then prompt for an administrator user name and password. Which kind of defies the purpose of a script determining administrative rights.
I just spoke to the developers. Currently there is no built in function to check if the current user has administrator privileges on Vista. However, we are currently developing some UAC functions that should be available in the next release of WinBatch (2007C). One of these functions should be able to tell you if the current logged in user has administrative privileges.
What exactly are you trying to accomplish? Currently you can still use ErrorMode or IntControl 73 to capture errors for the specific administrative operation, if the function errors then you might be able to assume it doesn't have the adminstrative rights depending on the operation. Keep your eye out for the next release of WinBatch 2007C.
Article ID: W17298
File Created: 2007:07:03:14:29:24
Last Updated: 2007:07:03:14:29:24