Jump to content

Search the Community

Showing results for tags 'AD'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. As the Active Directory UDF - Help & Support thread has grown too big, I start a new one. The original thread can be found here.
  2. I'm using this to get all the computer objects in a OU. There should only be 700 ish elements. I get 1600 elements, but 900 of them are empty. $aTmpOU = _AD_GetObjectsInOU($sOU,"(name=*)", 2, "managedBy,cn,distinguishedName,sAMAccountName,description","cn") Can I somehow avoid that?
  3. Hello, <edit> In this posting below you will find a script to get an Active Directory User's Group Memberships including nested Group Memberships: </edit> quite a while ago I started this thread: https://www.autoitscript.com/forum/topic/193984-ad-member-of-group-in-group/ #include <AD.au3> _AD_Open() $user=_AD_SamAccountNameToFQDN("ASP") $group=_AD_SamAccountNameToFQDN("daten-Bestellung-QS_lesen") $result=_AD_IsMemberOf($group,$user,false,True) ; $Group is the 1st, $User the 2nd param ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _AD_Close() this works fine, thanks for the help in the other thread. Howto to get the "chain" of groups for nested group memberships? In AD.AU3 I found the function _AD_RecursiveGetMemberOf(), which might be an approach, (get all the group content then sort out what's needed), just wondering if there is another function that I've overlooked, that directly would give me the "nested membership chain" *ONLY*? Regards, Rudi.
  4. Hello All, It has been a long time since I posted, role changes etc involving work and I finally am back to modifying a program I write in AutoIt that has AD integration. I am at a point where we are modifying our structure where I am validating users access via what Distribution List they belong to in our AD OU's. What I have run into is the OU is a sub OU of a sub OU now. Meaning: CN=team, OU=DL, OU=Groups, DC=business.com(working), is now CN=Team, OU=SubDL, OU=DL, OU=Groups, DC=business.com (Not working). Just curious if the AD functionality should be able to read it or maybe I am missing something? ElseIf _AD_IsMemberOf("CN=Team,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then #works for primary Distro ElseIf _AD_IsMemberOf("CN=Team,OU=SubDL,OU=Distribution Lists,OU=Groups,DC=business,DC=com", $sFQDN_User) Then #fails for subOU of DL How I am accessing AD to get the information: _AD_Open() Global $aUser = _AD_GetObjectsInOU("", "(&(objectCategory=person)(objectClass=user)(samaccountname=" & @UserName & "))", 2, "ADsPath,Displayname,distinguishedName") Global $sDisplayName0 = $aUser[1][1] ; Displayname ;MsgBox(0,"", $sDisplayName0) If StringLeft($sDisplayName0, 2) = "9-" Then $Displaynamestring = StringTrimLeft($sDisplayName0, 2) $Displaynamestring1 = StringTrimRight($Displaynamestring, 6) The error code generated is a 1 with a 0 extended. I assume it is because it cannot find the SubOU. Thanks for any assistance.
  5. I'm trying to read all cells used in column "C" in excel to an array but not sure how. Local $NameArray = _Excel_RangeRead($oWorkbook, $oWorkbook.Activesheet, $oWorkbook.Range["C"].End)
  6. Hey Guys, Good? I'm ned help to consult in other domain. My three domain contains any domains. How do I get this query done? Tks for the Help!
  7. Hello, from this posting of @Jos https://www.autoitscript.com/forum/topic/162005-getting-windows-users-account-type/?do=findComment&comment=1176831 I can smoothly check, if a user is a *DIRECT* group member. Has anybody some code to check also, if a user is a *INDIRECT* member of a cascaded group construct? Maybe with @Melba23 's AD UDF? The required rights are granted to group "Dept_B" User John is member of group "Dept_A" Group "Dept_A" is member of the group "Dept_B" So in the AD / NTFS FS environment John finally has the rights of both groups But when checking his "membership to group Dept_B" the result is "no member". The approach I can think of would be, to check all Group Members of group "Dept_B" whether they are of type group, then check again if "John" is member of than " 2nd level group" Func UserInGroup($InGroup,$ThisUser=@LogonDomain & "/" & @UserName) Local $objUser = ObjGet("WinNT://" & $ThisUser ) For $oGroup in $objUser.Groups If $oGroup.Name = $InGroup Then Return 1 EndIf Next Return 0 EndFunc Any suggestions appreciated, regards, Rudi.
  8. I've been playing with the AD UDF (by water) and I'm really not sure how it works (even after playing for several hours) and I'm hoping that someone can point me in the right direction on this. What I want to do is make it so if I give a network username, it returns back the information about said user (IE name, org, dept, etc). I know the info is in AD, I just don't know how to pull it using the UDF. Anyone have suggestions?
  9. Hi guys, I'd like to write a piece of tool that would allow me to update a certain field in our Active Directory from a comma separated csv file composed like this: This file, automatically generated, can hold more than 10k lines. Thus, I need column A to be in one variable, column B in a second one and column C in a third one. I'm really missing this part as updating the AD is fairly easy once the 3 variable are populated. I see things like this: Here's my attempts at the moment: #include <File.au3> #include <Array.au3> Global $csv_file = @DesktopDir & "\Book1.csv" Global $aRecords If Not _FileReadToArray($csv_file,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Msgbox(0,'Record:' & $x, $aRecords[$x]) ; Shows the line that was read from file $csv_line_values = StringSplit($aRecords[$x], ",",1) ; Splits the line into 2 or more variables and puts them in an array ; _ArrayDisplay($csv_line_values) ; Shows what's in the array you just created. ; $csv_line_values[0] holds the number of elements in array ; $csv_line_values[1] holds the value ; $csv_line_values[2] holds the value ; etc Msgbox(0, 0, $csv_line_values[1]) Next Any help on this please? Thanks in advance -31290-
  10. Should the AD UDF support the fine grained password policy available since Windows Server 2012? What do fine-grained password policies do? You can use fine-grained password policies to specify multiple password policies in a single domain and apply different restrictions for password and account lockout policies to different sets of users in a domain.
  11. Hello. I have 5 DCs, and I need to create a scheduled task to run a script that will test the authentication time for each one of them, once every minute. (Then I'll use it within a log analyser to create graphics). I came up with a script using the great AD UDF (by water). First I tried using "for" and an array, but something was messing up the results, then I went for the dumb old fashioned way: #Include <ad.au3> #include <MsgBoxConstants.au3> Global $AdTestTime = "" Global $Timer1, $Timer2, $Timer3, $Timer4, $Timer5 = "" Global $sAD1 = "MYSERVER109" Global $sAD2 = "MYSERVER110" Global $sAD3 = "MYSERVER111" Global $sAD4 = "MYSERVER112" Global $sAD5 = "MYSERVER113" $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2 = Timerinit() _AD_Open("", "", $sAD2) _AD_Close() Local $fDiff2 = TimerDiff($Timer2) $Timer3 = Timerinit() _AD_Open("", "", $sAD3) _AD_Close() Local $fDiff3 = TimerDiff($Timer3) $Timer4 = Timerinit() _AD_Open("", "", $sAD4) _AD_Close() Local $fDiff4 = TimerDiff($Timer4) $Timer5 = Timerinit() _AD_Open("", "", $sAD5) _AD_Close() Local $fDiff5 = TimerDiff($Timer5) MsgBox(0,"", "MYSERVER109=" & $fDiff1) MsgBox(0,"", "MYSERVER110=" & $fDiff2) MsgBox(0,"", "MYSERVER111=" & $fDiff3) MsgBox(0,"", "MYSERVER112=" & $fDiff4) MsgBox(0,"", "MYSERVER113=" & $fDiff5) Still, something is off here. The first AD to be tested is always the slowest one, by far, like 20 times slower. Then I started to suspect that the first one starts the "negotiation", and the following ones ride the gravy train. If I repeat the first code twice, All servers seem to have a similar result. $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer1 = Timerinit() _AD_Open("", "", $sAD1) _AD_Close() Local $fDiff1 = TimerDiff($Timer1) $Timer2.... Am I right? Also, is there a better way to test the authentication time? Thanks for the help. - Dave
  12. #RequireAdmin #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AD.au3> #include <Array.au3> #include <GuiButton.au3> #include <String.au3> #Region ### START Koda GUI section ### Form= Global $Form1_1 = GUICreate("Get User Groups", 419, 501, -1, -1) Global $Username = GUICtrlCreateInput("", 176, 80, 121, 21) Global $Button1 = GUICtrlCreateButton("GetGroups", 24, 120, 75, 25) Global $Groups = GUICtrlCreateEdit("", 24, 168, 369, 313, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "") GUICtrlSetData(-1, "") Global $Label2 = GUICtrlCreateLabel("Copy and paste the text below and add it to the onboarding ticket.", 80, 40, 318, 17) Global $Cancel = GUICtrlCreateButton("Cancel", 312, 120, 75, 25) Global $Disable = GUICtrlCreateButton("Copy", 120, 120, 75, 25) Global $Expire = GUICtrlCreateButton("Expire", 216, 120, 75, 25) Global $Unique = GUICtrlCreateLabel("Unique Username", 56, 80, 89, 25) GUISetState(@SW_SHOW) WinActivate($Form1_1) _GUICtrlButton_Enable($Username) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GroupArray() Case $Disable Copy() Case $Cancel Exit EndSwitch WEnd ;~ Functions Func GroupArray() _AD_Open() Global $Inputbox = GUICtrlRead($Username) If @error Then Exit MsgBox(16, "Active Directory", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ; Get a sorted array of group names (FQDN) that the user is immediately a member of Global $aUser = _AD_GetUserGroups($Inputbox) If @error > 0 Then MsgBox(64, "Active Directory Function", "User '" & $Inputbox & "' has not been assigned to any group or cannot be found.") Else _ArraySort($aUser, 0, 1) $sString = _ArrayToString($aUser, "; ") Global $sorted = _StringBetween($sString, "CN=", ",") Global $Format = _ArrayToString($sorted, "; ") Guictrlsetdata($Groups, $Format) EndIf ; Close Connection to the Active Directory _AD_Close() EndFunc ;==>GroupArray Func Copy() $copy = GUICtrlRead($groups) ClipPut($copy) EndFunc I've found this to be very useful but It only shows the names of the groups in FDQN format. In order to import multiple groups back into AD The have to be formatted like so: Domain users; Finance; Domain Admins; This allows you to copy and paste that back into an AD account where you need add multiple groups to one user. I've written something to clean it up a bit but i'm new to autoit. I just started like 2 weeks ago and i'm not sure how to sort info. The script i've written allows you to take the appropriate info out but it take a little too much info out. I'm using string between and I'd like to know if there is a way to extract info better from the array used in _AD_GetUserGroups I've attached my script and GUI but it pulls too much info due to the _stringbetween function. I just need to know if there is a better way? GetGroups.au3
  13. Good afternoon, I am running the instructions below, and even using a username or password missing, $error always returns "The operation completed successfully." $result = _AD_Open ( $user , $password , "dc=proxy,dc=trtsp,dc=jus,dc=br" , "proxy.trtsp.jus.br" ) If @error <> 0 Then $error = _AD_GetlastADSIError () _ArrayDisplay ( $error ) Exit EndIf Version of AD is 1.4.0.0 in AutoIt 3.3.8.1 (https://www.autoitscript.com/forum/topic/106163-active-directory-udf/). someone could tell me why this occurs rather than showing the detailed description of an error when the login fails using _ad_open?
  14. So I'm writing a post install script for my Win7 boxes, and I log in as a local user the first time to do some things that only seem to work from within a user account. I want to check that the domain join succeeded or try it again, but the obvious @LogonDomain or @LogonDNSDomain only show if the account currently logged in is part of the domain - which it isn't. How can I check the domain name from a local user account? If I right click on Computer and go to Properties, it says "Domain" and shows the domain name "example.com"... I want to check "example.com" against a value, but I'm not sure how to pull that value?
  15. Hello all.. I am trying to convert Active Directory computer account last used date to a readable format. I have some functions that will do this, but they use the following command to perform the command: w32tm /ntte <NT time epoch> Convert a NT system time, in (10^-7)s intervals from 0h 1-Jan 1601, into a readable format. This is super slow when dealing with thousands of records. Here is what I have so far... #include <array.au3> #include <DateTimeConvert.au3> #include <Date.au3> $exampleADTimeStamp = "130793861794571914" Msgbox(0,"MyResult", "Timestamp: " & $exampleADTimeStamp & @crlf & "Days since last Login: " & DateStringToDaysSinceLastLogin($exampleADTimeStamp)) Func DateStringToDaysSinceLastLogin($Timestamp) $ParseOutput = ParseLL($Timestamp) $ParseOutput = StringSplit($ParseOutput, " ", 2) $newFinal = _DateStandardToCalcDate($ParseOutput[0]) Return Abs(CompareD($newFinal)) EndFunc ;==>DateStringToDaysSinceLastLogin Func ParseLL($oLastLogon) $sOutput = "" $iPID = Run(@ComSpec & " /c " & "w32tm.exe /ntte " & $oLastLogon, @TempDir, @SW_HIDE, 2) While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd $sOutput = StringSplit($sOutput, " - ", 2 + 1) Return $sOutput[1] EndFunc ;==>ParseLL Func CompareD($Datez) Return _DateDiff("D", @YEAR & "/" & @MON & "/" & @MDAY, $Datez) EndFunc ;==>CompareD I'm sure there has got to be a better way to calculate this date format without having to use a command line tool, but after searching the forums, I haven't found anything.. Does anyone have any thoughts? Thanks in advance!!!
  16. Hi Guys, Im having a bit of trouble with the AD UDF - I know its me and not the UDF but i thought i had this working well until i introduced a domain check before my function. It appears at that point my domain check is ignoring my commands and always going with the domain of the currently logged on user ut i dont know why. Here is my code: #include <File.au3> #include <MsgBoxConstants.au3> #include <AD.au3> Global $sFQDN_User, $Groups, $sUserIdParam, $sPasswordParam, $sDNSDomainParam, $sHostServerParam, $sConfigurationParam FileWrite(@ScriptDir & "\TestGroups.txt", "SoftwareInstaller-All" & @CRLF) FileWrite(@ScriptDir & "\TestGroups.txt", "SoftwareInstaller-ProfServ" & @CRLF) FileWrite(@ScriptDir & "\TestGroups.txt", "SoftwareInstaller-Sales" & @CRLF) DetectAD() Func DetectAD() If @LogonDNSDomain = "Domain.one.two" Then ADCheckOT() ElseIf @LogonDNSDomain = "Domain.three" Then ADCheckT() EndIf EndFunc ; Syntax.........: _AD_Open([$sUserIdParam = "", $sPasswordParam = ""[, $sDNSDomainParam = "", $sHostServerParam = "", $sConfigurationParam = ""[, $iSecurity = 0]]]) Func ADCheckOT() _AD_Open($sUserIdParam = "", $sPasswordParam = "", $sDNSDomainParam = "DC=domain,DC=one,DC=two", $sHostServerParam = "", $sConfigurationParam = "") ;Then ; Get the Fully Qualified Domain Name (FQDN) for the current user $sFQDN_User = _AD_SamAccountNameToFQDN() _FileReadToArray(@ScriptDir & "\TestGroups.txt", $Groups) For $i = 1 To $Groups[0] $sFQDN_Group = $Groups[$i] ; Check the group membership of the specified user for the specified group $iResult = _AD_IsMemberOf($sFQDN_Group, $sFQDN_User) Select Case $iResult = 1 If $sFQDN_Group = "SoftwareInstaller-All" Then MsgBox(0,"","SoftwareInstaller-All") ElseIf $sFQDN_Group = "SoftwareInstaller-ProfServ" Then MsgBox(0,"","SoftwareInstaller-ProfServ") ElseIf $sFQDN_Group = "SoftwareInstaller-Sales" Then MsgBox(0,"","SoftwareInstaller-Sales") EndIf EndSelect Next _AD_Close() EndFunc Func ADCheckT() _AD_Open($sUserIdParam = "", $sPasswordParam = "", $sDNSDomainParam = "DC=domain,DC=three", $sHostServerParam = "", $sConfigurationParam = "") ;Then ; Get the Fully Qualified Domain Name (FQDN) for the current user $sFQDN_User = _AD_SamAccountNameToFQDN() _FileReadToArray(@ScriptDir & "\TestGroups.txt", $Groups) For $i = 1 To $Groups[0] $sFQDN_Group = $Groups[$i] ; Check the group membership of the specified user for the specified group $iResult = _AD_IsMemberOf($sFQDN_Group, $sFQDN_User) Select Case $iResult = 1 If $sFQDN_Group = "SoftwareInstaller-All" Then MsgBox(0,"","SoftwareInstaller-All") ElseIf $sFQDN_Group = "SoftwareInstaller-ProfServ" Then MsgBox(0,"","SoftwareInstaller-ProfServ") ElseIf $sFQDN_Group = "SoftwareInstaller-Sales" Then MsgBox(0,"","SoftwareInstaller-Sales") EndIf EndSelect Next _AD_Close() EndFunc FileDelete(@ScriptDir & "\TestGroups.txt")Im pretty sure i dont understand the syntax, I dont want to specify a username or password i just want to specify which domain to check as i should be able to query groups this without having to authenticate. The idea is that the script will check which domain they are on first, then connect to the correct domain to check group membership, if they are in 1 of the groups then another function will run - replaced with MsgBoxs for the reproducer. Can someone point me in the right direction? Thanks
  17. I'm looking at a situation where a client has an application deployed via RemoteApp, no full RDP desktop or web interface available. As the RemoteApp is published on a network share, it is invoked via a batch file, launched via a published .rdp file. I've run into an issue with being able to allow users to change their own passwords. I don't want to have to deal with changing users passwords, or knowing what they are; if I expire or require a password change, the users are simply locked out, there is no opportunity for them to change their password themselves. Ideally, I'd like to write or find a command line utility I could insert into the batch file that launches the remote app to address this deficiency. I've poked around in the ActiveDirectory UDF, which seems to be a great tool, but without a function written for the use case where the password change is desired to be forced upon the current user ( who is NOT an admin). Note: net user / domain requires admin rights. pspasswd, while awesome, also requires admin rights. Does anyone have a UDF or Function utility that they use to allow a user to change their own domain password from the command line? I've seen a couple of powershell examples, but I'd love to be able to compile or drop in a command line oriented passwd.exe utility that would work similarly to the *nix equivalent. The pspasswd sysinternals utility does not seem to have this use case in mind -- in my tests you have to be an admin to change a password.
  18. Hi All, Now before I start, I have trawled through the forum & elsewhere for the last 24 hours or so & found nothing to even point me in the right direction. I have a rather large script that's doing various (AD reads & applying RegWrites based on the SID & AD reads....) & I've stripped it all back & the problem appears to lie with the create object which is calling a sproc I wrote to pull back various based on params passed. Now for the actual issue, all worked fine first time everywhere apart from within a Citrix xenapp session which is when I'm getting hit with the Exception Occured Script Line -1 - Variable must be of type 'Object'. Here is a stripped back portion which I've been testing with against xenapp (with a MsgBox added to easily see if anything did return), can anyone notice anything glaringly stupid that I'm doing? Global $AppError = ObjEvent("AutoIt.Error","ErrFunc") $Emp=@UserName $adDSN="Driver={SQL Server};Server=*****;Database=*****;Uid=****;Pwd=*****" $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ($adDSN) $FNsQuery = "exec [ooo_sp_ad_user] @user="&$Emp&",@type=1" $FNresult = $adCN.Execute($FNsQuery) $ADFirstName=$FNresult.Fields("").Value MsgBox(0, "AD Test", $ADFirstName) $adCN.Close Func ErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($AppError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $AppError.WinDescription & @CRLF $strMsg &= "Script Line: " & $AppError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Any pointers at all would be greatly appreciated. Thanks Bob
  19. This is a simple incomplete password reset tool, my 3rd script with autoit, so the code is elementary. This is something you can use to customize and make your own. It will generate a password, and give you the nato readout so you can read it to an end user over the phone. Feel free to update and make it better, I no longer require it so enjoy! #include <File.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AD.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AD PAssword Reset Tool", 509, 276, 250, 152) $Label1 = GUICtrlCreateLabel("Password Reset Tool", 40, 8, 442, 46) GUICtrlSetFont(-1, 28, 400, 0, "Arial") GUICtrlSetColor(-1, 0x000000) Global $rnd, $result2 = "" $Input3 = GUICtrlCreateInput("", 60, 96, 400, 32, $SS_CENTER) GUICtrlSetFont(-1, 16, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("Generate Password", 16, 64, 107, 25) $Button2 = GUICtrlCreateButton("Set Password", 260, 162, 75, 25) $Button3 = GUICtrlCreateButton("Unlock Account", 155, 162, 99, 25) $Input1 = GUICtrlCreateInput("", 16, 160, 121, 21) $Group1 = GUICtrlCreateGroup("Account status", 8, 188, 489, 81) $Label4 = GUICtrlCreateLabel("Username: ", 16, 204, 58, 17) $Label5 = GUICtrlCreateLabel("Locked: ", 16, 220, 46, 17) $Label6 = GUICtrlCreateLabel("Password Age:", 16, 236, 75, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label7 = GUICtrlCreateLabel("", 26, 133, 436, 24, $SS_CENTER) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $z = "rvxs|rdmf|jzlr|izez|lbyl|yjmz|wzet|pyau|qumv|aocr|wwal|qhyh|dlou|ruqj|vgmg|edpg|wsmv|qmnt|kwgr|tduz|jzgq|ywdn|etet|hxvj|ydwp|vvzx|cwcs|fcru|dnin|jwna|pwks|xoak|audd|ppwe|omzq|xwcy|dudn|rwtz|qvtg|jgzi|hxkr|azug|ixla|iikl|ovgk|skpj|kldj|ovwg|psfy|jmck|gkea|bjmq|trfc|tppm|jvae|fgah|scbj|pqtl|gses|gtzz|xtid|snds|xkok|zgcb|iktk|cvil|ynxn|fqqs|qakc|cnsc|jiaz|nryi|brev|olbe|whfs|kpro|lkcg|vvlp|pjlf|igvl|mnyp|shco|nite|exji|drai|gdgd|cylw|hlgr|qfya|dqle|xhgn|jkbl|cghi|xcow|iwui|ltqm|olmx|rujq|ehop|xpgr|zjfg|zebn|iezt|gazx|cgft|tefk|jijz|smhj|zbwr|vxsd|wjmp|sjbk|hyzm|sszr|iqbq|marj|pdsn|derh|sjit|udlh|xwaz|aodg|quab|gxka|exhs|pzdo|bpjf|pizm|xtio|tdiz|txxv|jaat|hcwi|ekrz|zpyy|ppnm|yewo|upzi|zfmw|suii|alvm|zklz|xesg|nyqk|lvih|eppa|mbdk|soju|hnkt|ifsd|wnzk|pndo|ydrj|bzfs|madj|jhcz|ygnw|zrdu|qskm|lbux|qtdt|xjyy|zkfd|yzhd|dwgn|jdun|kteh|geke|warj|qucv|lvqs|jdda|vrfb|qzjj|rvuo|kzfr|jlka|svhy|dctk|lkss|viju|dqpq|dgxw|mcwy|rtxw|ptsj|bebg|kduq|iivb|zygi|hwql|sgia|hvmj|msxx|woxb|vvsc|zplz|brpf|iyyq|vdvp|dxre|mtky|csjv|yfdl|podp|svrn|eovx|nzax|uplb|neiv|yzdk|mtgq|qrzx|kkhl|rxgm|brqr|fqsv|wcpe|acyf|oqeo|utci|susu|ttha|qnnx|utwc|eoih|bema|abjh|ijyx|tihy|gyll|bkae|kett|mbtk|fuyr|fokr|cazl|exro|azla|cyzv|bnfx|mnxi|qlak|jlai|tcor|fcpy|hudz|zosz|tgzl|zqli|rody|xrvj|ntit|keji|xixi|wbmd|lajm|rlps|klqj|woth|fhmk|psxp|npaz|naph|ahfz|pdkb|fnga|tisy|kijq|drqj|fyym|nfej|vaqa|hnrk|lkeh|wbrh|rmie|iuab|lbxz|mvto|qkqo|wfbk|zawj|sfnb|dagk|vxts|pfnn|eatb|ozor|pkje|slxb|fmpv|yqil|owry|ducb|dywa|xguz|ybrj|eoff|lhfp|qwqk|pada|oele|szmo|lvdw|rsjh|ygid|mtrh|zycp|pfoe|icpz|vxkd|rsdm|isrf|nhsh|mbzq|rukh|usrj|cwno|nxph|utro|xghu|ynvw|wswr|vngd|ahpw|uimq|tirj|ysbv|aetj|wwsx|jxcu|fxvw|mszs|pcuo|tvjf|tsef|setx|zrnr|vcmk|pthb|vqpl|tzfa|lqpu|jqbg|flru|jdrb|agfb|qajb|gopo|dfen|vfnp|myvp|fptx|qvbv|qiii|uuaw|khnh|ujnj|mlds|wicf|ihwv|wumi|smhd|pfda|tltj|ixdo|xvor|zuid|hgst|xfqf|yuuy|qesp|ulke|rqoc|yyae|ejbr|lrob|xwrw|fgcc|phmn|jeib|btmn|sxbn|znio|qxhe|trto|tzty|ohqn|qaej|pgdk|oqvy|dnqb|lfmh|guom|pumx|hxnl|jxxm|pipj|hxjw|jlvu|mbql|hvnh|dzii|xpyx|fjtx|gxjd|ixuy|evpb|ogjp|wqxi|bogv|laoo|bslx|axtq|uwca|qzmp|gojb|kctw|nzlj|fuyw|klzo|nvpg|vhfx|vnmj|jrtx|yuin|lwbr|bpsh|txok|gvrp|acfz|tjga|kgew|rmrh|wszy|fulz|otgd|gnyh|fvsk|roox|xixy|nwqu|rdne|rngx|tyjq|gbrj|kgtn|zoys|pten|sptz|oxkh|kbin|uvwr|cgqw|smec|pvoe|hmdw|nkxs|bzzp|dkzu|txzu|ktrm|bbgp|esgh|ocza|mnoy|ejfc|xfwb|rwkz|mrbl|apwe|wmdr|ojgb|pfvi|napt|mwmb|wukl|rfzs|injw|jmpw|pmxe|pncm|smtx|xgee|oqhe|cqry|sipu|vaew|fuzw|ymkc|vvnr|lrip|nbsn|kjdn|nfdd|amcg|cncw|gmiw|juzo" $wlist = StringSplit($z, "|", 3) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _AD_OPEN() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _AD_CLOSE() Exit Case $Button1 generate() Case $Button2 setpw() EndSwitch WEnd Func GenSymbol() $symnum = Random(1, 7, 1) If $symnum = 1 Then Global $symbb = "!" If $symnum = 2 Then Global $symbb = "@" If $symnum = 3 Then Global $symbb = "$" If $symnum = 4 Then Global $symbb = ";" If $symnum = 5 Then Global $symbb = "?" If $symnum = 6 Then Global $symbb = "%" If $symnum = 7 Then Global $symbb = "#" EndFunc ;==>GenSymbol Func generate() Global $rnd = Random(1000, 9999, 1) Global $result = "" GUICtrlSetData($Input3, $result) Global $line = $wlist[Random(1, UBound($wlist))] GenSymbol() nato1() $line = $symbb & $line & $rnd GUICtrlSetData($Input3, $line) $rnd2 = StringSplit($rnd, "") EndFunc ;==>generate Func nato1() $myword = $line symbol($symbb) $array = StringSplit($myword, "", 1) For $i = 1 To UBound($array) - 1 $z = nato2($array[$i]) $result = $result & $nato & " " Next $nums = StringSplit($rnd, "", 1) For $i = 1 To UBound($nums) - 1 $y = digit($nums[$i]) $result2 = $result2 & $numb & " " Next $result = $symb & " " & $result & $result2 GUICtrlSetData($Label7, $result) ;GUICtrlSetData($Label8, "") $result = "" $result2 = "" EndFunc ;==>nato1 Func setpw() If Not GUICtrlRead($Input3) Then MsgBox(0, "Error", "You must generate a password first.") Else MsgBox(0, "Complete", "Password has been set. Thank you.") EndIf EndFunc ;==>setpw Func nato2($letter) If $letter = "a" Then Global $nato = "Alpha" If $letter = "b" Then Global $nato = "Bravo" If $letter = "c" Then Global $nato = "Charlie" If $letter = "d" Then Global $nato = "Delta" If $letter = "e" Then Global $nato = "Echo" If $letter = "f" Then Global $nato = "Foxtrot" If $letter = "g" Then Global $nato = "Golf" If $letter = "h" Then Global $nato = "Hotel" If $letter = "i" Then Global $nato = "India" If $letter = "j" Then Global $nato = "Juliet" If $letter = "k" Then Global $nato = "Kilo" If $letter = "l" Then Global $nato = "Lima" If $letter = "m" Then Global $nato = "Mike" If $letter = "n" Then Global $nato = "November" If $letter = "o" Then Global $nato = "Oscar" If $letter = "p" Then Global $nato = "Papa" If $letter = "q" Then Global $nato = "Quebec" If $letter = "r" Then Global $nato = "Romeo" If $letter = "s" Then Global $nato = "Sierra" If $letter = "t" Then Global $nato = "Tango" If $letter = "u" Then Global $nato = "Uniform" If $letter = "v" Then Global $nato = "Victor" If $letter = "w" Then Global $nato = "Whiskey" If $letter = "x" Then Global $nato = "X-ray" If $letter = "y" Then Global $nato = "Yankee" If $letter = "z" Then Global $nato = "Zulu" Return EndFunc ;==>nato2 Func symbol($sym) If $sym = "!" Then Global $symb = "Exclamation-Mark" If $sym = "@" Then Global $symb = "At-Sign" If $sym = "$" Then Global $symb = "Dollar-Sign" If $sym = ";" Then Global $symb = "Semi-Colon" If $sym = "?" Then Global $symb = "Question-Mark" If $sym = "%" Then Global $symb = "Percent-Sign" If $sym = "#" Then Global $symb = "Pound-Sign" Return EndFunc ;==>symbol Func digit($num) If $num = "1" Then Global $numb = "One" If $num = "2" Then Global $numb = "Two" If $num = "3" Then Global $numb = "Three" If $num = "4" Then Global $numb = "Four" If $num = "5" Then Global $numb = "Five" If $num = "6" Then Global $numb = "Six" If $num = "7" Then Global $numb = "Seven" If $num = "8" Then Global $numb = "Eight" If $num = "9" Then Global $numb = "Nine" If $num = "0" Then Global $numb = "Zero" Return EndFunc ;==>digit Feel free to update and make it better.
  20. Hi Guys/Gals, I'm using the AD UDF to interogate our AD (the computers section, which we have under an OU of managed), what I'm trying to do (and failing horribly) is recurse through the sub OU's and place them inside a treeview container. e.g Access | |-Teachers |- Students |-Office but I can't get it to go past the first sub OU, and it's creating duplicates... my code is below #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <ProgressConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <AD.au3> $ADToolbox = GUICreate("ADToolbox", 1245, 789, 192, 124) $Root = GUICtrlCreateTreeView(8, 8, 241, 769, BitOR($GUI_SS_DEFAULT_TREEVIEW,$WS_BORDER)) $Itemspane = GUICtrlCreateListView("", 256, 8, 801, 681) $taskprog = GUICtrlCreateProgress(256, 696, 801, 25, BitOR($PBS_SMOOTH,$PBS_MARQUEE,$WS_BORDER)) GUISetState(@SW_SHOW) _AD_Open() Global $aOUs = _AD_GetAllOUs("OU=Computers,OU=Managed,DC=SCHOOL,DC=LOCAL", "", 0) If @error > 0 Then MsgBox(48, "Active Directory Functions", "No OUs could be found") Else $iCount = 2 Do $sOU = "ou=" & StringReplace($aOUs[$iCount - 1][0], "\", ",ou=") & "," & $sAD_DNSDomain $trunk = stringsplit($sOU, ",") if $trunk[0] > 4 Then $leafcount = 0 $branchno = 0 do if $branchno = 0 then if $trunk[5] <> "DC=Local" and $trunk[5] <> "DC=SCHOOL" then $branch = GUICtrlCreateTreeViewItem($trunk[5], $root) $branchno = 1 $leafcount = $leafcount + 1 else $leafcount = $leafcount + 1 EndIf Else $count = 0 $leafname = 0 do if $leafname = 0 Then if $trunk[6] <> "DC=Local" and $trunk[6] <> "DC=SCHOOL" then $leaf = GUICtrlCreateTreeViewItem($trunk[6], $Branch) $leafname = 1 $count = $count + 1 else $count = $count + 1 $leafname = 0 EndIf endif until $count = $trunk[0] $leafname=0 $branchno = 0 $count = 0 EndIf until $leafcount = $trunk[0] $leafcount = 0 $branchno = 0 EndIf $iCount=$iCount+1 until $iCount = $aOUs[0][0] EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd thanks in advance RichE
  21. Hey all, back with some more AD questions. Is it possible to return machine info (computer name) given a username? Id like to know what computer a specific user is logged in to (and maybe a little history of when they last logged in to which computer), and Im thinking my best odds are using the AD UDF? Thanks for any help!!
  22. Greetings, here is what I am running into.. About my setup: Computer 1: is on the domain, user account logged in is in local admin group and is a member of the domain, and has elevated AD abilities Computer 2 (testing computer) logged in to by local admin account (not domain user), is on the domain. when I execute this on computer 1, it returns the proper OU, on computer 2, it throws an Error 4 during the _AD_Open portion: #include dim $sAD_UserIdParam, $sAD_PasswordParam _AD_Open( $sAD_UserIdParam = "ServiceProfile", $sAD_PasswordParam = "MyPassword") If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) $fullou = (_AD_SamAccountNameToFQDN("DomainUserAccount")) Msgbox(0, "Message", "This is Mikes OU:" & @CRLF & $fullou) _AD_Close() Keep in mind, I changed usernames and profiles to protect the innocent When I run this on computer 2, I get Error 4 which is: 4 - Creation of the RootDSE object failed. @extended returns the error code received by the COM error handler. Generated when connection to the domain isn't successful. @extended returns -2147023541 (0x8007054B) Any thoughts?
  23. I have been working on this for days with no luck. I am working on a script to move laptops into the proper OU specified by $sTargetOU while the computer name is $sObject The situation: IT people are logged onto laptops using the end user account (to profile them) which apparently does not have permissions to move computer accounts in AD from one OU to another. The other situation: When I profile a new laptop for a user, I am logged in as local admin and try to use a script to move the computer into a specified OU. I have credentials that I can use to move the computer account, but I would like to package this into an autoit script. I currently use AD.au3, which does the job as long as I am logged in with an IT AD account with sysadmin abilities. What I am looking to do: Simple one stop shop application that lets me runas a function similar to that below: _AD_Open() Global $iValue = _AD_MoveObject($sTargetOU, $sObject & "$") If $iValue = 1 Then MsgBox(64, "Active Directory Message", "Computer '" & $sObject & "' successfully moved to '" & $sTargetOU & "'") ElseIf @error = 1 Then MsgBox(64, "Active Directory Message", "Target OU '" & $sTargetOU & "' does not exist") ElseIf @error = 2 Then MsgBox(64, "Active Directory Message", "Computer '" & $sObject & "' does not exist") ElseIf @error = 3 Then MsgBox(64, "Active Directory Message", "Computer '" & $sObject & "' is already in the required OU. No change made.") ElseIf @error = "-2147352567" Then MsgBox(64, "Active Directory Message", "Could not move '" & $sObject) Else MsgBox(64, "Active Directory Message", "Return code '" & @error & "' from Active Directory") EndIf _AD_Close() I appreciate any thoughts anyone might have because I'm at a dead stop. Thanks in advance
  24. Hey all, Been doing some work with AD. I am able to return specific info given a username. However, I want the input to accept a format of "LastName,FirstName", search AD for a match and return the username. Is this possible? Thank you very much for any help!
  25. Hello I'm trying to get email from AD with _AD_GetObjectAttribute. the following script gives back email adress for given sAMAccountName: #include <AD.au3> Global $aProperties _AD_Open() If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) $aProperties = _AD_GetObjectAttribute("anysAMAccountName", "mail") ClipPut($aProperties) MsgBox(0,"",$aProperties) _AD_Close() Tried many sAMAccountName's it works good, but on one Name 'XiaopenL' result is: '$FUNCTION.CONET_JS_toLowerCase($FUNCTION.CONET_JS_CheckEMail($FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Lu)$$)$$.$FUNCTION.CONET_JS_changeUmlaut($FUNCTION.CONET_JS_getFirstPart(Xiaopeng)$$)$$@xxx.xx!!99999999)$$)$$' This is not the mail adress. Is it a failure of the AD-server?
×
×
  • Create New...