Sign in to follow this  
Followers 0
ScottPostSr

Error in Active Directory query

7 posts in this topic

#1 ·  Posted (edited)

I have a vbsctript that pulls information from Active Directory.  I am trying to use similar code in AutoIT.

 

I have this:

This works all the way to the point where I try to get the properties from the user account, then I get "The requested action with this object has failed."
 

The vbscript works fine, I just can't figure out why AutoIT fails.

Edited by ScottPostSr

Share this post


Link to post
Share on other sites



Welcome to AutoIt and the forum!

Can you please post the code you use?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

AutoIT:

$ado = ObjCreate("ADODB.Connection")

$ado.Open("Provider=ADsDSOObject")

$dn = $rs.Fields("distinguishedName").Value

$strTSHDPath = $User.terminalservicesHomeDirectory

$strTSProfile = $User.terminalServicesProfilePath

$strProfile = $User.HomeDirectory

Vbscript

Set oADO = CreateObject("ADODB.Connection")

oADO.Open "Provider=ADsDSOObject"

sDN = oRS.Fields("distinguishedName").Value

strHomeDir = oUser.HomeDirectory

strTSHomeDir = oUser.terminalservicesHomeDirectory

strTSProfile = oUser.terminalservicesProfilePath

Share this post


Link to post
Share on other sites

For some reason, I can't seem to post the GetObject or ObjGet statements but they are LDAP queries with the distinguishedName property

Share this post


Link to post
Share on other sites

There is a UDF available to interact with Active Directory. For download please check my signature.

Makes coding and error handling much easier.

#include <AD.au3>
_AD_Open()
$sTSHomeDirectory = _AD_GetObjectAttribute(@Username, "terminalservicesHomeDirectory")

I can't test at the moment so I'm not sure you can access the TerminalServices attributes this way because they are stored in a BLOB.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I still can't pull up the terminal services properties with AutoIT but can with vbscript.  Can you tell me how to post my code so it retains all the lines?  I have it in a text file, but can't figure out how to upload the text file.

Share this post


Link to post
Share on other sites

To upload a file click on "Full Editor / Attachments".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0