Re: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Ben Scott
On Thu, Dec 29, 2011 at 3:55 PM, Michael B. Smith wrote: > The Active Directory Cookbook (third edition) covers doing "everything" in > PowerShell where AD is concerned. > Active Directory (fourth edition) also has a strong PowerShell bias. I've got both of those, and I can say they're also ve

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Michael B. Smith
egards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com -Original Message- From: Ben Scott [mailto:mailvor...@gmail.com] Sent: Thursday, December 29, 2011 3:42 PM To: NT System Admin Issues Subject: Re: Deciphering "UserAccountControl" using PowerShe

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Ben Scott
On Thu, Dec 29, 2011 at 3:18 PM, Mike Leone wrote: > Thanks. I'll make note of that. I'm learning this on my own, rather than > with a class or book (yet), so I'm not as grounded as I could/should be ... I will say that "PowerShell in Action" is a pretty good introduction to the language so far

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Mike Leone
al Message- From: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Thursday, December 29, 2011 2:40 PM To: NT System Admin Issues Subject: RE: Deciphering "UserAccountControl" using PowerShell Huh. Below is working code from a production script. Just for grins and giggles, can you

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Michael B. Smith
mith [mailto:mich...@smithcons.com] Sent: Thursday, December 29, 2011 2:40 PM To: NT System Admin Issues Subject: RE: Deciphering "UserAccountControl" using PowerShell Huh. Below is working code from a production script. Just for grins and giggles, can you try it all in lower-case? That

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Michael B. Smith
tControl[0] (note square brackets, not parens. > > Regards, > > Michael B. Smith > Consultant and Exchange MVP > http://TheEssentialExchange.com > > > -Original Message- > From: Michael Leone [mailto:oozerd...@gmail.com] > Sent: Wednesday, December 28, 20

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Michael Leone
> Michael B. Smith > Consultant and Exchange MVP > http://TheEssentialExchange.com > > > -Original Message- > From: Michael Leone [mailto:oozerd...@gmail.com] > Sent: Wednesday, December 28, 2011 3:18 PM > To: NT System Admin Issues > Subject: Re: Deciphering "UserAccount

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-29 Thread Markko Meriniit
"User is disabled"} else { "User is enabled" } Markko > -Original Message- > From: Michael Leone [mailto:oozerd...@gmail.com] > Sent: Wednesday, December 28, 2011 2:01 PM > To: NT System Admin Issues > Subject: Deciphering "UserAccountControl" using P

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Ben Scott
On Wed, Dec 28, 2011 at 3:17 PM, Michael Leone wrote: >        if ($User.userAccountControl -band $ADS_UF_NORMAL_ACCOUNT ) > The '-band' operator failed: Cannot convert the > "System.DirectoryServices.PropertyValueCollection" value of type > "System.DirectoryServices.PropertyValueCollection" to ty

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael B. Smith
Message- From: Michael Leone [mailto:oozerd...@gmail.com] Sent: Wednesday, December 28, 2011 3:18 PM To: NT System Admin Issues Subject: Re: Deciphering "UserAccountControl" using PowerShell On Wed, Dec 28, 2011 at 2:44 PM, Ben Scott wrote: >  Do a bitwise AND between the candidate

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael Leone
On Wed, Dec 28, 2011 at 3:17 PM, Michael Leone wrote: > On Wed, Dec 28, 2011 at 2:44 PM, Ben Scott wrote: > >>  Do a bitwise AND between the candidate user's value and ACCOUNT_DISABLED. >> >>  I'm only on page 143 of "PowerShell in Action", and haven't gotten >> to bitwise operators yet, but Goog

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael Leone
On Wed, Dec 28, 2011 at 2:44 PM, Ben Scott wrote: >  Do a bitwise AND between the candidate user's value and ACCOUNT_DISABLED. > >  I'm only on page 143 of "PowerShell in Action", and haven't gotten > to bitwise operators yet, but Google results suggest this should work: > > if ($user.UserAccount

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Ben Scott
On Wed, Dec 28, 2011 at 2:01 PM, Michael Leone wrote: > So I know that the AD attribute "UserAccountControl" is the sum of the > values of 21 different values (i.e., so a value of 546 = 2+32+512, > which is composed of the sum of the constants ACCOUNT_DISABLED, > PASSWORD_NOT_REQUIRED, and NORMAL_

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael B. Smith
e userAccountControl attribute. Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com -Original Message- From: Damien Solodow [mailto:damien.solo...@harrison.edu] Sent: Wednesday, December 28, 2011 2:07 PM To: NT System Admin Issues Subject: RE: Deciph

Re: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael Leone
On Wed, Dec 28, 2011 at 2:07 PM, Damien Solodow wrote: > You might be over-engineering the solution. :) > Try this to get a list of disabled users: Get-ADUser -Filter {enabled -eq > $false} I don't want a list of all disabled users, tho. I just need to figure out if the specific user I am workin

RE: Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Damien Solodow
] Sent: Wednesday, December 28, 2011 2:01 PM To: NT System Admin Issues Subject: Deciphering "UserAccountControl" using PowerShell So I know that the AD attribute "UserAccountControl" is the sum of the values of 21 different values (i.e., so a value of 546 = 2+32+512, which

Deciphering "UserAccountControl" using PowerShell

2011-12-28 Thread Michael Leone
So I know that the AD attribute "UserAccountControl" is the sum of the values of 21 different values (i.e., so a value of 546 = 2+32+512, which is composed of the sum of the constants ACCOUNT_DISABLED, PASSWORD_NOT_REQUIRED, and NORMAL_ACCOUNT). But how do I break that down in Powershell? For examp