Merzavets

Parse bitwise data in Powershell

Dec 28th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $status = @{1 = "Offline" ; 2 = "Paper Tray Empty" ; 4 = "Toner Exhausted" ; 8 = "Paper Jam" }
  2. $value = 12
  3.  
  4.  $status.Keys | where { $_ -band $value } | foreach { $status.Get_Item($_) } # "Paper Jam \nToner Exhausted"
Add Comment
Please, Sign In to add comment