troubleshooting Question

Automating get-qaduser (pass credentials)

Avatar of jat0369
jat0369 asked on
6 Comments1 Solution1592 ViewsLast Modified:
Hello Everyone.

I'm trying to script a fully automated script to query an OU from a machine not currently connected to a domain.  I've got the script fully working as long as I manually pass my credentials at the time the script runs.  I have a restricted service account setup for this purpose and I can't seem to figure out how to pass the username and password through the script.  I don't care if the username and password are exposed.

So far, I've created...

$secUN = convertto-securestring "\Service-Account" -AsPlaintext -force
$secPW = convertto-securestring "password!" -AsPlaintext -force
$MyCreds = New-Object System.Management.Automation.PSCredential ($secUN, $secPW)
connect-qadservice =credential $MyCreds -ConnectionPassword $MyCreds
get-qaduser -searchroot  '' -sizelimit 0 | select-object name, description | export-csv c:\install\staging\staging.csv
What am I missing? How can I run get-qadcomputer and pass a username/password through it?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros