![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 64 bit binary or (-bor operator)? Hi all, Anyone know of a trick to get PowerShell to do "binary or" on a 64-bit integer (type System.UInt64)? I need it to set the anonymous permissions on a SharePoint site, as such: $siteCollection.RootWeb.AnonymousPermMask64 = [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories -bor [Microsoft.SharePoint.SPBasePermissions]::Open -bor [Microsoft.SharePoint.SPBasePermissions]::OpenItems -bor [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs -bor [Microsoft.SharePoint.SPBasePermissions]::ViewListItems -bor [Microsoft.SharePoint.SPBasePermissions]::ViewPages -- Victor |
My System Specs![]() |
| | #2 (permalink) |
| | Re: 64 bit binary or (-bor operator)? On Mar 3, 4:03*am, l0b0 <victor.engm...@xxxxxx> wrote: Quote: > Hi all, > > Anyone know of a trick to get PowerShell to do "binary or" on a 64-bit > integer (type System.UInt64)? I need it to set the anonymous > permissions on a SharePoint site, as such: > $siteCollection.RootWeb.AnonymousPermMask64 = > [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories -bor > [Microsoft.SharePoint.SPBasePermissions]::Open -bor > [Microsoft.SharePoint.SPBasePermissions]::OpenItems -bor > [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs -bor > [Microsoft.SharePoint.SPBasePermissions]::ViewListItems -bor > [Microsoft.SharePoint.SPBasePermissions]::ViewPages > > -- > Victor $siteCollection.RootWeb.AnonymousPermMask64 = ` "BrowserDirectories, Open, OpenItems, UseRemoteAPIs, ViewListItems, ViewPages" PowerShell is able to coerce this string to a flags decorated enum. For ordinary enums, just use a single string with the name of the value. Hope this helps, - Oisin |
My System Specs![]() |
| | #3 (permalink) |
| | Re: 64 bit binary or (-bor operator)? Oisin's given you I suspect the best solution, but in terms of doing a 64-bit bor, one way would be to convert each of the numbers to binary eg $binary_int1 = [Convert]::ToString($int1,2).PadLeft(64,"0") create bit arrays into which you put your ones or zeroes (boolean true or false) $BitArray_int1 = new-object System.Collections.BitArray(64) and then use the 'Or' method of the bit array with another such construction. Then convert the result back. Another approach might be to split each of the 2 64-bit integers in two - higher and lower 32 bits and then compare the higher 32-bits of one integer with the higher 32-bits of the other, and similarly the lower portion. Then recombine the results. Sorry if that's a bit rambled, and I've missed out a few of the 'bor-ing' details (sorry couldn't resist ;-) ) but it may give you some ideas. -- Jon "l0b0" <victor.engmark@xxxxxx> wrote in message news:58015422-323a-4ae0-9f38-6bec5c124865@xxxxxx Quote: > Hi all, > > Anyone know of a trick to get PowerShell to do "binary or" on a 64-bit > integer (type System.UInt64)? I need it to set the anonymous > permissions on a SharePoint site, as such: > $siteCollection.RootWeb.AnonymousPermMask64 = > [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories -bor > [Microsoft.SharePoint.SPBasePermissions]::Open -bor > [Microsoft.SharePoint.SPBasePermissions]::OpenItems -bor > [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs -bor > [Microsoft.SharePoint.SPBasePermissions]::ViewListItems -bor > [Microsoft.SharePoint.SPBasePermissions]::ViewPages > > -- > Victor |
My System Specs![]() |
| | #4 (permalink) |
| | Re: 64 bit binary or (-bor operator)? Thank you both! Turns out this didn't solve my actual problem though: How to get anonymous access to SharePoint web services: <http:// groups.google.com/group/ microsoft.public.sharepoint.windowsservices.development/browse_thread/ thread/f9893dde5bf19067/960631001fcc5053> On Mar 5, 12:43 am, "Jon" <Email_Addr...@xxxxxx> wrote: Quote: > Oisin's given you I suspect the best solution, but in terms of doing a > 64-bit bor, one way would be to convert each of the numbers to binary eg > > $binary_int1 = [Convert]::ToString($int1,2).PadLeft(64,"0") > > create bit arrays into which you put your ones or zeroes (boolean true or > false) > > $BitArray_int1 = new-object System.Collections.BitArray(64) > > and then use the 'Or' method of the bit array with another such > construction. > > Then convert the result back. > > Another approach might be to split each of the 2 64-bit integers in two - > higher and lower 32 bits and then compare the higher 32-bits of one integer > with the higher 32-bits of the other, and similarly the lower portion. Then > recombine the results. > > Sorry if that's a bit rambled, and I've missed out a few of the 'bor-ing' > details (sorry couldn't resist ;-) ) but it may give you some ideas. > > "l0b0" <victor.engm...@xxxxxx> wrote in message > > news:58015422-323a-4ae0-9f38-6bec5c124865@xxxxxx > Quote: > > Anyone know of a trick to get PowerShell to do "binary or" on a 64-bit > > integer (type System.UInt64)? I need it to set the anonymous > > permissions on a SharePoint site, as such: > > $siteCollection.RootWeb.AnonymousPermMask64 = > > [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories -bor > > [Microsoft.SharePoint.SPBasePermissions]::Open -bor > > [Microsoft.SharePoint.SPBasePermissions]::OpenItems -bor > > [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs -bor > > [Microsoft.SharePoint.SPBasePermissions]::ViewListItems -bor > > [Microsoft.SharePoint.SPBasePermissions]::ViewPages |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| -ne operator | PowerShell | |||
| Powershell Operator | PowerShell | |||
| -f operator | PowerShell | |||
| What does the $() operator do? | PowerShell | |||
| How to embed manifest in TCL binary? - mt.exe corrupting my binary | Vista General | |||