Solved

Powershell help

Posted on 2014-11-03
7
108 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
  • 4
  • 2
7 Comments
 
LVL 70

Expert Comment

by:Chris Dent
Comment Utility
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
Comment Utility
Well the functional level is 2008.. is there an extension that I have missed thats separate?
0
 
LVL 14

Author Comment

by:Ben Hart
Comment Utility
Ok so yeah. I'm missing something here.  Those two attributes exist under Advanced Features but that query returns nothing.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 39

Expert Comment

by:footech
Comment Utility
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
Comment Utility
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 39

Accepted Solution

by:
footech earned 500 total points
Comment Utility
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
Comment Utility
Beautiful.  Worked like a pack mule.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now