Solved

powershell array to represent the OU.

Posted on 2013-11-07
3
167 Views
Last Modified: 2013-11-14
I was using quest to get this to run and I am having some problems. Can someone please tell me where the problem might be with this code. I posted this but the code did not work in what I received in the reply.


@(
"OU=USERS,OU=HR,DC=SOMECOMPANY,DC=COM"
"OU=USERS,OU=FINANCE,DC=SOMECOMPANY,DC=COM"
"OU=USERS,OU=SALES,DC=SOMECOMPANY,DC=COM"
"OU=USERS,OU=IT,DC=SOMECOMPANY,DC=COM"
) | % {

Get-QADUser -searchroot $_ | Set-QADUser -passwordneverexpire $true

}
0
Comment
Question by:techdrive
  • 2
3 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39631509
What is the problem?
0
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39633266
You did not enter comma at the end of each line.

@(
"OU=USERS,OU=HR,DC=SOMECOMPANY,DC=COM",
"OU=USERS,OU=FINANCE,DC=SOMECOMPANY,DC=COM",
"OU=USERS,OU=SALES,DC=SOMECOMPANY,DC=COM",
"OU=USERS,OU=IT,DC=SOMECOMPANY,DC=COM"
) | % {

Get-QADUser -searchroot $_ | Set-QADUser -passwordneverexpire $true

}
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39633445
It will work without comma...
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question