chaoticyeshua
Active Members-
Posts
77 -
Joined
-
Last visited
Recent Profile Visitors
chaoticyeshua's Achievements
Wayfarer (2/7)
2
Reputation
-
Active Directory UDF - Help & Support (III)
chaoticyeshua replied to water's topic in AutoIt General Help and Support
Thanks for the recommendation!- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
Active Directory UDF - Help & Support (III)
chaoticyeshua replied to water's topic in AutoIt General Help and Support
Hello, With Microsoft's domain join changes mentioned in this article, I am needing a way to prompt a local user account for a technician's AD credentials and then use those credentials to change ownership of a computer object to their AD account to complete the domain join using their credentials. We used to use a service account, but this will no longer function as of this September since it is not the owner of the AD objects. I've been told by our Enterprise Systems team that they will not implement the group policy on the domain controllers to allow specified users/groups to join computers to the domain, and have instead been instructed to delete computer objects and have them get auto-created by a manual domain join process. This is unacceptable to me and would prefer to automate ownership changes. However, I don't see a way in your UDF to change ownership of an object. Is there a way to do that? Thank you for any assistance you can provide.- 875 replies
-
- active directory
- ad
-
(and 2 more)
Tagged with:
-
HTTP POST Request, Dell Warranty API
chaoticyeshua posted a topic in AutoIt General Help and Support
Hello, I was approved for a v5 Dell TechDirect API key and am having some issues that I was hoping to receive some input on. My code is designed to retrieve warranty information through Dell's API for computers in our inventory as a part of our imaging process. Our existing code for their v4 API is working perfectly, but they recently made some changes to their process. Now, we are given an API key and a client secret, and we must use those to generate a token which expires every hour. I'm having what I consider to be an odd issue which makes the script, as we have historically used it, extremely problematic. First, the code itself (note that there's obviously more code than this, but this is enough to demonstrate the issue): ;First we need to get the token ;Create HTTP Object Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHttp.Option(9) = 0x800 ;Open a POST request at the api. The 'False' is because we are opening the request synchronously $oHTTP.Open("POST", "https://apigtwb2c.us.dell.com/auth/oauth/v2/token", False) ;We need to set the content-type because our credentials are being sent in like a form $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ;In case the client_id or the client secret changes, here is where you would change them Local $client_id = "myapikey" Local $client_secret = "myclientsecret" ;Lastly we need to send the request, the string parameter is the credentials we are sending in. $oHTTP.Send('grant_type=client_credentials&client_id=' & $client_id & '&client_secret=' & $client_secret) When the code was first written, it worked fine on the computer it was initially run on. Once the code was being tested by someone else on their computer, they received the following error: "No credentials were available in the client certificate" Upon reading into the issue, it seems that winhttp objects use the first cert in the "CURRENT_USER\My" store for some purpose unknown to us. The error itself seemed to be resolved by adding the line $oHttp.SetClientCertificate("CURRENT_USER\My\mycert") and pointing to a specific cert in the store (in our case, replace the "mycert" signature with the user's email address). However, we typically run this script as a local user account, rather than under a user's domain account, as a part of our computer imaging process. We are unable to make this script work under a local user account, and we aren't sure why pointing to a cert is even required. It doesn't seem to me that it should be. Is there anyone out there with more knowledge that can point us in the right direction to make this work under a local user account? Edit: FYI, I have already reached out to Dell and they just said they can't help me. -
Skysnake reacted to a post in a topic: Idle Timer from Local System Account?
-
Earthshine reacted to a post in a topic: Idle Timer from Local System Account?
-
Idle Timer from Local System Account?
chaoticyeshua replied to chaoticyeshua's topic in AutoIt General Help and Support
That's basically what I'm already doing with my current script. However, as I said previously, the script closes when the user clicks sign out from the start menu but has open unsaved documents. It basically gets far enough along in the log out process to close the script, but didn't force quit the remaining applications. I resolved the issue by applying the above registry keys so it force closes hung tasks when the user manually logs off. -
Idle Timer from Local System Account?
chaoticyeshua replied to chaoticyeshua's topic in AutoIt General Help and Support
I ended up resolving this by applying the following registry keys in Group Policy: HKEY_CURRENT_USER\Control Panel\Desktop Value Type: REG_SZ Value Name: AutoEndTasks Value Data: 1 Value Type: REG_SZ Value Name: HungAppTimeout Value Data: (time in ms to wait before killing tasks) -
Idle Timer from Local System Account?
chaoticyeshua replied to chaoticyeshua's topic in AutoIt General Help and Support
Thanks for the suggestion. Is there a similar way to detect keystrokes just in case the user is using the keyboard but not the mouse? I understand this dangerously falls into a scenario where there might be keylogging involved, but this is not my intention. I currently have an Idle Logoff script that runs under the user's session each login, but since we started using Windows 10 we've run into a few issues. If they log out utilizing the start menu and have, for example, open Word documents, then the logout process hangs trying to inform them they need to save their documents. By the time that screen comes up, they've usually already left the computer. Unfortunately, it seems to get far enough along in the logout process that it closes my Idle Logoff script and so the computer just stays there logged in with their account. -
Hello, I am curious if there is a way to detect the console user's idle time from the Local System account (i.e., as a service or scheduled task). I've attempted using _Timer_GetIdleTime and _WinAPI_GetIdleTime with not so good results. For example, _Timer_GetIdleTime returns a very high number when elevated to run as System using psexec and a low number when not. Essentially, I am attempting to develop a method of logging off idle sessions in computer labs utilizing the System account to detect whether the user is idle or not. Any advice would be appreciated. Example returns: Run as System - Idle time (ms): 358198875 Run by manually opening compiled exe - Idle time (ms): 5126 Thanks!
-
Issues with Shutdown Function
chaoticyeshua replied to chaoticyeshua's topic in AutoIt General Help and Support
Actually, it looks like Windows Defender SmartScreen started blocking the compiled script on some of the computers. I'm looking into a way to add it as an exception. Thanks for the suggestion! -
Hi everyone. I work for a university, and as a part of our IT security policies we must have a solution to log off idle users after a certain period of time. I've used a script to monitor idle time and log off idle users for several years without any issues, until we imaged our labs with Windows 10 (1703). Now, when issuing the shutdown command to log off, it gets stuck logging off if the user has open and unsaved documents, requesting to save them before logging off, even if utilizing the force and force if hung options. Back in Windows 7, just utilizing Shutdown(16) was adequate, but I've also tried Shutdown(20) with the same results. Other than killing open processes before calling shutdown, does anyone have any ideas that may help? What's weird is I can run the same script with open/unsaved documents on my computer and it logs me off without any issues, so I'm not entirely sure what's triggering the problem on our lab computers. #include <Misc.au3> AutoItSetOption("TrayIconHide", 1) ;Check if the script is already running If Not _Singleton(@ScriptName, 1) Then Exit While 1 $iIdleTime = _Timer_GetIdleTime() ;Time is in ms, so 1000 is 1 second If $iIdleTime >= 900000 Then ;Log off $sIdleCheck = MsgBox(48, "Idle Session", "University IT security policies dictate that any publicly available computer must log off idle users after a certain period of time." & @CRLF & @CRLF & "The computer has been idle for 10 minutes. If you are still at the computer, please press OK to reset the timer. Otherwise, you will be logged off in 90 seconds.", 90) If $sIdleCheck <> 1 Then Shutdown(16) EndIf EndIf ;Only check idle time every 5 seconds to prevent excessive CPU/memory usage Sleep(5000) WEnd ; #FUNCTION#;=============================================================================== ; ; Name...........: _Timer_GetIdleTime() ; Description ...: Returns the number of ticks since last user activity (i.e. KYBD/Mouse) ; Syntax.........: _Timer_GetIdleTime() ; Parameters ....: None ; Return values .: Success - integer ticks since last (approx. milliseconds) since last activity ; Failure - Sets @extended = 1 if rollover occurs (see remarks) ; Author ........: PsaltyDS at http://www.autoitscript.com/forum ; Modified.......: v1.0.0 -- 03/20/2008 First version ; v1.0.1 -- 06/11/2008 Fixed bug when idle time = 0ms ; Remarks .......: The current ticks since last system restart will roll over to 0 every 50 days or so, ; which makes it possible for last user activity to be before the rollover, but run time ; of this function to be after the rollover. If this happens, @extended = 1 and the ; returned value is ticks since rollover occured. ; Related .......: _CheckIdle() ; Link ..........; ; Example .......; Yes ; ;;========================================================================================== Func _Timer_GetIdleTime() ; Get ticks at last activity Local $tStruct = DllStructCreate("uint;dword"); DllStructSetData($tStruct, 1, DllStructGetSize($tStruct)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($tStruct)) ; Get current ticks since last restart Local $avTicks = DllCall("Kernel32.dll", "int", "GetTickCount") ; Return time since last activity, in ticks (approx milliseconds) Local $iDiff = $avTicks[0] - DllStructGetData($tStruct, 2) If $iDiff >= 0 Then ; Normal return Return $iDiff Else ; Rollover of ticks counter has occured Return SetError(0, 1, $avTicks[0]) EndIf EndFunc ;==>_Timer_GetIdleTime
-
Thank you for the advice. I ended up resolving this by using XML.au3's tidy function to clean up the XML file downloaded from Dell, then reading the file into an array and finding the data I need using StringInStr.
-
chaoticyeshua reacted to a post in a topic: Help Parsing XML
-
XML.au3 - BETA - Support Topic
chaoticyeshua replied to mLipok's topic in AutoIt Projects and Collaboration
I'm not able to get your Dell warranty example to return any values even when using your provided sample code (.au3 and .xml). All of the values are just blank. The console fills with data from the XML file, so I know it's being read, but the array does not have any data in it. Is there something I am doing wrong? -
Never mind, I just found the updated version of _XMLDomWrapper at This has example code for how to do what I'm needing to do so I will try to figure it out on my own Thanks
-
Hi all, I am needing some assistance with parsing some XML code. The purpose of this is to pull warranty information for Dell computers I support. I am needing only the EndDate value on the first AssetEntitlement node, and unfortunately I cannot seem to get _XMLDomWrapper to work. The below code works to read in the XML file and list the child nodes: AdditionalInformation AssetWarrantyResponse ExcessTags InvalidBILAssets InvalidFormatAssets Unfortunately, I can't figure out how to read anything at all below each of the above child nodes. I'm very unfamiliar with how to parse XML files. ;Create a Microsoft XML HTTP object Local $oXML = ObjCreate("Microsoft.XMLHTTP") ;Open a connection to the Dell REST API to pull the warranty information. This returns XML code $oXML.Open("GET", "https://api.dell.com/support/assetinfo/v4/getassetwarranty/" & GUICTRLRead($iSerialNumber) & "?apikey=XXXXXXXXXXXXXXXXXXXXXXXXXX", 0) $oXML.SetRequestHeader("Accept", "Application/xml") $oXML.Send ;Create a file in temp with the returned XML code $sFile = _TempFile(@TempDir, '~', '.xml') FileWrite($sFile, $oXML.responseText) If _XMLFileOpen($sFile) Then Local $aRet = _XMLGetChildNodes('//*') If Not @error Then For $i = 1 To $aRet[0] ConsoleWrite($aRet[$i] & @LF) Next EndIf EndIf XML: <AssetWarrantyDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Dell.Support.AssetsExternalAPI.Web.Models.V1.Response"> <AdditionalInformation i:nil="true"/> <AssetWarrantyResponse> <AssetWarrantyResponse> <AssetEntitlementData> <AssetEntitlement> <EndDate>2018-07-13T23:59:59</EndDate> <EntitlementType>INITIAL</EntitlementType> <ItemNumber>997-7188</ItemNumber> <ServiceLevelCode>ND</ServiceLevelCode> <ServiceLevelDescription> Onsite Service After Remote Diagnosis (Consumer Customer)/ Next Business Day Onsite After Remote Diagnosis (Commercial Customer) </ServiceLevelDescription> <ServiceLevelGroup>5</ServiceLevelGroup> <ServiceProvider>UNY</ServiceProvider> <StartDate>2015-07-13T00:00:00</StartDate> </AssetEntitlement> <AssetEntitlement> <EndDate>2018-07-13T23:59:59</EndDate> <EntitlementType>INITIAL</EntitlementType> <ItemNumber>984-1772</ItemNumber> <ServiceLevelCode>KK</ServiceLevelCode> <ServiceLevelDescription>Keep Your Hard Drive Service</ServiceLevelDescription> <ServiceLevelGroup>11</ServiceLevelGroup> <ServiceProvider>DELL</ServiceProvider> <StartDate>2015-07-13T00:00:00</StartDate> </AssetEntitlement> <AssetEntitlement> <EndDate>2018-07-13T23:59:59</EndDate> <EntitlementType>INITIAL</EntitlementType> <ItemNumber>997-7208</ItemNumber> <ServiceLevelCode>TS</ServiceLevelCode> <ServiceLevelDescription>ProSupport</ServiceLevelDescription> <ServiceLevelGroup>8</ServiceLevelGroup> <ServiceProvider>DELL</ServiceProvider> <StartDate>2015-07-13T00:00:00</StartDate> </AssetEntitlement> </AssetEntitlementData> <AssetHeaderData> <BUID>11</BUID> <CountryLookupCode>US</CountryLookupCode> <CustomerNumber>142366234</CustomerNumber> <IsDuplicate>false</IsDuplicate> <ItemClassCode>J2002</ItemClassCode> <LocalChannel>65</LocalChannel> <MachineDescription>Precision Tower Workstation (T5810)</MachineDescription> <OrderNumber>852696778</OrderNumber> <ParentServiceTag i:nil="true"/> <ServiceTag>XXXXXX</ServiceTag> <ShipDate>2015-07-13T00:00:00</ShipDate> </AssetHeaderData> <ProductHeaderData> <LOB>Dell Precision WorkStation</LOB> <LOBFriendlyName>Precision WorkStation</LOBFriendlyName> <ProductFamily>Desktops & All-in-Ones</ProductFamily> <ProductId>precision-t5810-workstation</ProductId> <SystemDescription>Precision Tower Workstation (T5810)</SystemDescription> </ProductHeaderData> </AssetWarrantyResponse> </AssetWarrantyResponse> <ExcessTags> <BadAssets xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/> </ExcessTags> <InvalidBILAssets> <BadAssets xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/> </InvalidBILAssets> <InvalidFormatAssets> <BadAssets xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/> </InvalidFormatAssets> </AssetWarrantyDTO> Any help would be greatly appreciated!!
-
I'm attempting to use the Dell API to get warranty information about assets, and parse the returned XML file using AutoIt. I cannot for the life of me seem to get this to work right. I can get it to open the XML file and tell me there's one child node (GetAssetWarrantyResult), but cannot seem to get it to read any of the values in its children even though I am specifying the namespace xmlns:a="http://schemas.datacontract.org/2004/07/Dell.AWR.Domain.Asset". Can anyone help me? Here's the XML file contents I'd like it to look at, and I am specifically concerned with the "StartDate" and "EndDate" items in the warranty sections. <GetAssetWarrantyResponse xmlns="http://tempuri.org/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <GetAssetWarrantyResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/Dell.AWR.Domain.Asset"> <a:Faults/> <a:Response> <a:DellAsset> <a:AssetParts i:nil="true"/> <a:CountryLookupCode>11</a:CountryLookupCode> <a:CustomerNumber>123456789</a:CustomerNumber> <a:IsDuplicate>false</a:IsDuplicate> <a:ItemClassCode>J2002</a:ItemClassCode> <a:LocalChannel>65</a:LocalChannel> <a:MachineDescription>DELL PWS TOWER 5810,AVALONFCTO</a:MachineDescription> <a:OrderNumber>852696778</a:OrderNumber> <a:ParentServiceTag i:nil="true"/> <a:ServiceTag>SERVICETAG</a:ServiceTag> <a:ShipDate>2015-07-13T00:00:00</a:ShipDate> <a:Warranties> <a:Warranty> <a:EndDate>2018-07-13T23:59:59</a:EndDate> <a:EntitlementType>INITIAL</a:EntitlementType> <a:ItemNumber>997-7188</a:ItemNumber> <a:ServiceLevelCode>ND</a:ServiceLevelCode> <a:ServiceLevelDescription>Next Business Day Support</a:ServiceLevelDescription> <a:ServiceLevelGroup>5</a:ServiceLevelGroup> <a:ServiceProvider>UNY</a:ServiceProvider> <a:StartDate>2015-07-13T00:00:00</a:StartDate> </a:Warranty> <a:Warranty> <a:EndDate>2018-07-13T23:59:59</a:EndDate> <a:EntitlementType>INITIAL</a:EntitlementType> <a:ItemNumber>984-1772</a:ItemNumber> <a:ServiceLevelCode>KK</a:ServiceLevelCode> <a:ServiceLevelDescription>Keep Your Hard Drive Service</a:ServiceLevelDescription> <a:ServiceLevelGroup>11</a:ServiceLevelGroup> <a:ServiceProvider>DELL</a:ServiceProvider> <a:StartDate>2015-07-13T00:00:00</a:StartDate> </a:Warranty> <a:Warranty> <a:EndDate>2018-07-13T23:59:59</a:EndDate> <a:EntitlementType>INITIAL</a:EntitlementType> <a:ItemNumber>997-7208</a:ItemNumber> <a:ServiceLevelCode>TS</a:ServiceLevelCode> <a:ServiceLevelDescription>Client Gold Support / ProSupport</a:ServiceLevelDescription> <a:ServiceLevelGroup>8</a:ServiceLevelGroup> <a:ServiceProvider>DELL</a:ServiceProvider> <a:StartDate>2015-07-13T00:00:00</a:StartDate> </a:Warranty> </a:Warranties> </a:DellAsset> </a:Response> </GetAssetWarrantyResult> </GetAssetWarrantyResponse>
-
That might do the trick. Thanks for the help!