?
Solved

Powershell help

Posted on 2014-11-03
7
Medium Priority
?
117 Views
Last Modified: 2014-11-04
Looking for a short script to do the following:

Search AD object for the following attributes: info which would be set to 'no sync' and flags set to '1'.  If found null both values and possible report back the accounts found with either of those two attributes set.
0
Comment
Question by:Ben Hart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 71

Expert Comment

by:Chris Dent
ID: 40421124
Just use an LDAP filter when you're requesting it the users.
(&(objectClass=user)(objectCategory=person)(info=no sync)(flags=1))

Open in new window

I assume you've extended the schema since neither info or flags exist in the schema by default. If you have not extended the schema you're going to have to explain which attributes you're looking for.

Chris
0
 
LVL 14

Author Comment

by:Ben Hart
ID: 40421853
Well the functional level is 2008.. is there an extension that I have missed thats separate?
0
 
LVL 14

Author Comment

by:Ben Hart
ID: 40421885
Ok so yeah. I'm missing something here.  Those two attributes exist under Advanced Features but that query returns nothing.
0
Problems using Powershell and Active Directory?

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

 
LVL 40

Expert Comment

by:footech
ID: 40422031
Try this.
get-adobject -filter {info -eq "no sync" -and flags -eq "1"}

Open in new window

It's a little odd, according to this link which shows all AD attributes, flags is on the list, but not info.
http://msdn.microsoft.com/en-us/library/ms675090(v=vs.85).aspx
I have "info" in my AD as well when I look at an object and I haven't extended my schema except for the installation of Exchange.
0
 
LVL 14

Author Comment

by:Ben Hart
ID: 40422054
Same here.. Exchange 2010 would have been the last schema change that I know of.

What I am trying to do is remove all attribute data that's currently blocking an unknown amount of objects from syncing via FIM.  Our parent company set all the FIM (PCNS) stuff up and we could use either flags = 1 or info = no sync to block syncing.
0
 
LVL 40

Accepted Solution

by:
footech earned 2000 total points
ID: 40422300
You would probably want to limit your search to specific OUs using the -searchbase parameter of Get-ADObject.  Examine the returned results to verify that there aren't some objects which should be excluded.  I know in my environment, I have some Group Policy objects that have flags set to 1.  Couldn't tell you what it means though.
Get-ADObject -filter {info -eq "no sync" -or flags -eq "1"} | Set-ADObject -Clear info,flags -WhatIf

Open in new window

0
 
LVL 14

Author Comment

by:Ben Hart
ID: 40422399
Beautiful.  Worked like a pack mule.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

752 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