shornw Posted March 25, 2009 Share Posted March 25, 2009 Hi all Does anyone know of a way to read the Local Admins group to establish whether or not an installation script will run. I have already implemented a script that adds a domain group to Local Admmins but as we have users from other domains logging on to PC's without any of our Local Admin members I cannot apply it to these machines. This is a critical software update that meeds to be applied to all machines running the software on a given day. Any help greatly appreciated. Thanks for looking [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font] Link to comment Share on other sites More sharing options...
Danny35d Posted March 25, 2009 Share Posted March 25, 2009 Look at the help file for IsAdmin ( ) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
jvanegmond Posted March 25, 2009 Share Posted March 25, 2009 Windows is inherently protected to prevent the reading of the SAM file. You can not do this while Windows is running. github.com/jvanegmond Link to comment Share on other sites More sharing options...
shornw Posted March 25, 2009 Author Share Posted March 25, 2009 Thanks for the replies. Can it not be read through windows? this info is available to anyone logged on (even standard users) via computer managment. [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font] Link to comment Share on other sites More sharing options...
jvanegmond Posted March 25, 2009 Share Posted March 25, 2009 Thanks for the replies.Can it not be read through windows? this info is available to anyone logged on (even standard users) via computer managment.No, you cannot actually read the file. You can request the information from Windows. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Ghost1987 Posted March 25, 2009 Share Posted March 25, 2009 (edited) No, you cannot actually read the file. You can request the information from Windows.Yes via NetGroupGetUsers() winapi function which I need too, but can't make it work. Code that I've got so far: #NoTrayIcon #RequireAdmin #include <Array.au3> $aRet = _NetUserGetGroups("Администратор") _ArrayDisplay($aRet, "Display Array") Func _NetUserGetGroups($sUsername, $sServer = "") Local $tBufPtr = DllStructCreate("ptr") Local $tEntriesRead = DllStructCreate("dword") Local $tTotalEntries = DllStructCreate("dword") Local $aRet = DllCall("Netapi32.dll", "int", "NetUserGetGroups", "wstr", $sServer, "wstr", $sUsername, "dword", 0, "ptr", DllStructGetPtr($tBufPtr), "dword", -1, "ptr", DllStructGetPtr($tEntriesRead), "ptr", DllStructGetPtr($tTotalEntries)) If $aRet[0] Then Return SetError(1, $aRet[0]) Local $iEntriesRead = DllStructGetData($tEntriesRead,1) Local $pBuf = DllStructGetData($tBufPtr,1) Local $sGroupUsersInfo0 = "ptr" Local $tGroupUsersInfo0 = DllStructCreate($sGroupUsersInfo0) Local $zGroupUsersInfo0 = DllStructGetSize($tGroupUsersInfo0) For $i=1 To $iEntriesRead $tGroupUsersInfo0 = DllStructCreate($sGroupUsersInfo0, $pBuf+($i-1)*$zGroupUsersInfo0) $tGroupName = DllStructCreate("wchar[256]", DllStructGetData($tGroupUsersInfo0,1)) Next DllCall("Netapi32.dll", "int", "NetApiBufferFree", "ptr", $pBuf) Return $aRet EndFunc ;_NetUserGetGroups Edited March 25, 2009 by Ghost1987 Link to comment Share on other sites More sharing options...
Danny35d Posted March 25, 2009 Share Posted March 25, 2009 The code below will give you an array list with the member of a group, otherwise return NULL.#include <Array.au3> $Administrators = _MemberOfGoups('dan') _ArrayDisplay($Administrators) Func _MemberOfGoups($strGroup = "Administrators") Local $aMembers = '' $objGroup = ObjGet("WinNT://" & @ComputerName & "/" & $strGroup) If IsObj($objGroup) Then For $objMember In $objGroup.Members $aMembers &= $objMember.Name & '|' Next $aMembers = StringSplit(StringTrimRight($aMembers, 1), '|') EndIf Return($aMembers) EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now