Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Bit Operators

Reply
 
Old 06-30-2006   #1 (permalink)
Wrighty


 
 

Bit Operators

Hi,

I am currently trying to do some AD modifications to the UserAccountControl
attribute using powershell but there does not appear to be many bitwise
operators in Powershell, specifically XOR.

From the Monad Language Quick Reference guide which I think came with Beta 1
it appears that there used to be a -bnot operator which has been removed.

Are there any plans to add more operators or is backing off to cmd.exe the
best bet?

Cheers
Dave



My System SpecsSystem Spec
Old 06-30-2006   #2 (permalink)
Wei Wu [MSFT]


 
 

Re: Bit Operators

-bnot was not removed, and we will have -bxor and -xor in our next release.
PS C:\monad> -bnot 1
-2
PS C:\monad> 1 -bxor 1
0

--
Wei Wu [MSFT]
Windows PowerShell Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"Wrighty" <dave.net@wrighty.net> wrote in message
news:eRfX6hDnGHA.1248@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I am currently trying to do some AD modifications to the
> UserAccountControl attribute using powershell but there does not appear to
> be many bitwise operators in Powershell, specifically XOR.
>
> From the Monad Language Quick Reference guide which I think came with Beta
> 1 it appears that there used to be a -bnot operator which has been
> removed.
>
> Are there any plans to add more operators or is backing off to cmd.exe the
> best bet?
>
> Cheers
> Dave
>



My System SpecsSystem Spec
Old 06-30-2006   #3 (permalink)
Andrew Watt [MVP]


 
 

Re: Bit Operators

Hi Wei Wu,

In that case there seems to be a doc bug in the Bitwise operators
section of about_operator.help.txt where -bnot is not mentioned.

Andrew Watt MVP

On Fri, 30 Jun 2006 07:28:19 -0700, "Wei Wu [MSFT]"
<wwu@microsoft.com> wrote:

>-bnot was not removed, and we will have -bxor and -xor in our next release.
>PS C:\monad> -bnot 1
>-2
>PS C:\monad> 1 -bxor 1
>0

My System SpecsSystem Spec
Old 06-30-2006   #4 (permalink)
Wrighty


 
 

Re: Bit Operators

Wei Wu,

Thanks for this, must have been going mad when I was looking earlier.

Great news that XOR is being added to the next release, PowerShell is
becoming a fantastic tool for all our day to day management.

Cheers
Dave

"Wei Wu [MSFT]" <wwu@microsoft.com> wrote in message
news:OyvKwFFnGHA.5056@TK2MSFTNGP04.phx.gbl...
> -bnot was not removed, and we will have -bxor and -xor in our next
> release.
> PS C:\monad> -bnot 1
> -2
> PS C:\monad> 1 -bxor 1
> 0
>
> --
> Wei Wu [MSFT]
> Windows PowerShell Team
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "Wrighty" <dave.net@wrighty.net> wrote in message
> news:eRfX6hDnGHA.1248@TK2MSFTNGP05.phx.gbl...
>> Hi,
>>
>> I am currently trying to do some AD modifications to the
>> UserAccountControl attribute using powershell but there does not appear
>> to be many bitwise operators in Powershell, specifically XOR.
>>
>> From the Monad Language Quick Reference guide which I think came with
>> Beta 1 it appears that there used to be a -bnot operator which has been
>> removed.
>>
>> Are there any plans to add more operators or is backing off to cmd.exe
>> the best bet?
>>
>> Cheers
>> Dave
>>

>
>



My System SpecsSystem Spec
Old 06-30-2006   #5 (permalink)
Wei Wu [MSFT]


 
 

Re: Bit Operators

Hi Andrew,
Please open a doc bug. Thanks.

--
Wei Wu [MSFT]
Windows PowerShell Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message
news:ghdaa2tvoofnveovo5d0qvre1cj95amshs@4ax.com...
> Hi Wei Wu,
>
> In that case there seems to be a doc bug in the Bitwise operators
> section of about_operator.help.txt where -bnot is not mentioned.
>
> Andrew Watt MVP
>
> On Fri, 30 Jun 2006 07:28:19 -0700, "Wei Wu [MSFT]"
> <wwu@microsoft.com> wrote:
>
>>-bnot was not removed, and we will have -bxor and -xor in our next
>>release.
>>PS C:\monad> -bnot 1
>>-2
>>PS C:\monad> 1 -bxor 1
>>0



My System SpecsSystem Spec
Old 06-30-2006   #6 (permalink)
Jeffrey Snover [MSFT]


 
 

Re: Bit Operators

> Great news that XOR is being added to the next release, PowerShell is
> becoming a fantastic tool for all our day to day management.

BTW - what do you use XOR for?

--
Jeffrey Snover [MSFT]
Windows PowerShell Architect
Microsoft Corporation
This posting is provided "AS IS" with no warranties, no confers rights.


My System SpecsSystem Spec
Old 06-30-2006   #7 (permalink)
Andrew Watt [MVP]


 
 

Re: Bit Operators

Done.

http://www.connect.microsoft.com/fee...2598&SiteID=99

Andrew Watt MVP

On Fri, 30 Jun 2006 07:37:25 -0700, "Wei Wu [MSFT]"
<wwu@microsoft.com> wrote:

>Hi Andrew,
>Please open a doc bug. Thanks.

My System SpecsSystem Spec
Old 07-03-2006   #8 (permalink)
Wrighty


 
 

Re: Bit Operators

Jeffrey,

In this case I was trying to flip a bit in the AD useraccountcontrol
attribute.

I was glad to hear from Wei Wu that BXOR is being added back as I am tempted
to utilise Powershell as the basis of our provisioning system for AD objects
and being able to modify these bits is a requirement.

Cheers
Dave



"Jeffrey Snover [MSFT]" <jsnover@microsoft.com> wrote in message
news:ec0gj1FnGHA.4376@TK2MSFTNGP03.phx.gbl...
>> Great news that XOR is being added to the next release, PowerShell is
>> becoming a fantastic tool for all our day to day management.

> BTW - what do you use XOR for?
>
> --
> Jeffrey Snover [MSFT]
> Windows PowerShell Architect
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, no confers rights.
>



My System SpecsSystem Spec
Old 07-04-2006   #9 (permalink)
/\\/\\o\\/\\/


 
 

Re: Bit Operators

you can also use InvokeSet for setting bits of the useraccountControl

$User.invokeSet('Accountdisabled',$false)

=

$user.userAccountControl = $user.userAccountControl[0] -band (-bnot 2)

for more info I just posted a blogentry about setting AD Poperties :
with more explaining

http://mow001.blogspot.com/2006/07/p...ry-part-3.html

gr /\/\o\/\/



Wrighty wrote:
> Jeffrey,
>
> In this case I was trying to flip a bit in the AD useraccountcontrol
> attribute.
>
> I was glad to hear from Wei Wu that BXOR is being added back as I am tempted
> to utilise Powershell as the basis of our provisioning system for AD objects
> and being able to modify these bits is a requirement.
>
> Cheers
> Dave
>
>
>
> "Jeffrey Snover [MSFT]" <jsnover@microsoft.com> wrote in message
> news:ec0gj1FnGHA.4376@TK2MSFTNGP03.phx.gbl...
>>> Great news that XOR is being added to the next release, PowerShell is
>>> becoming a fantastic tool for all our day to day management.

>> BTW - what do you use XOR for?
>>
>> --
>> Jeffrey Snover [MSFT]
>> Windows PowerShell Architect
>> Microsoft Corporation
>> This posting is provided "AS IS" with no warranties, no confers rights.
>>

>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
redirection operators as syntactic suger PowerShell
Powershell Operators PowerShell
CTP2 comparison operators PowerShell
Subexpressions and Unary Operators PowerShell
Any possibility for boolean operators in message rules? Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46