This is part of a function I wrote to switch SCCM advertisement flags; it
calculates current value and also sets the new values using -bxor for hex
values. It may get you started for what you are trying to accomplish.
$Adv.Get()
$old = ("Old Setting {0} on Advertisement Name: {1}" -f $Adv.AdvertFlags,
$Adv.AdvertisementName)
Write-Host $old -ForegroundColor Cyan
If ($Adv.AdvertFlags -band 0x00010000)
{
Write-Host ""("Check box is set: {0}" -f $Adv.AdvertFlags) ""
-ForegroundColor Green
$Adv.AdvertFlags = $Adv.AdvertFlags -bxor 0x00010000
}
else
{
Write-Host ""("Check box is NOT set: {0}" -f $Adv.AdvertFlags) ""
-ForegroundColor Red
$Adv.AdvertFlags = $Adv.AdvertFlags -bxor 0x00010000
}
$new = ("New Setting {0} on package Name: {1}" -f $Adv.AdvertFlags,
$Adv.AdvertisementName)
Write-Host $new -ForegroundColor Blue
$Adv.put() | Out-Null
On Tue, Aug 26, 2014 at 12:17 PM, Nash Pherson <[email protected]> wrote:
> Try the Bitwise Operators section of this article for info on doing
> bitwise comparisons and shifts:
>
> http://technet.microsoft.com/en-us/library/hh847759.aspx
>
>
>
> Mark Schill has an article on bitwise operations here:
>
> http://powerschill.com/uncategorized/bitwise-operators/
>
>
>
>
>
> I hope that helps,
>
>
>
>
>
> Nash
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *James Rankin
> *Sent:* Friday, August 22, 2014 4:54 AM
>
> *To:* [email protected]
> *Subject:* [NTSysADM] PowerShell
>
>
>
> Any idea if you can toggle a particular bit of a byte in a binary Registry
> key using PowerShell? My head is busted trying to work this out....
>
>
> --
>
> *James Rankin*
> ---------------------
> RCL - Senior Technical Consultant (ACA, CCA, MCTS) | The Virtualization
> Practice Analyst - Desktop Virtualization
> http://appsensebigot.blogspot.co.uk
>