1234567891011121314151617181920212223242526272829 |
- # List some example files
- Get-ChildItem w* -File | Format-Table name,attributes
- Get-ChildItem -force | Where-Object {$_.attributes -match "Offline"}
- # Select two for analysis
- foreach ($file in ('.\WirelessCodes.txt', '.\urgTimes.xlsx')) {
- # Get the attributes of the file
- $attributes = (Get-ItemProperty $file).Attributes
- # Show the binary flags that were set
- "{0}: {1}" -f ($file, ([System.Convert]::ToString($attributes.value__,2))) | Write-Host
- # These are probably the attributes that govern the OneDrive settings
- foreach ($attrib in ('ReparsePoint', 'Offline', 'SparseFile')) {
- " {0}: {1} {2}" -f (
- $attrib,
- ($attributes -band [System.IO.FileAttributes]::$attrib),
- ($attributes.value__ -band [System.IO.FileAttributes]::$attrib.value__)
- ) | Write-Host
- }
- }
- $file = '.\WirelessCodes.txt'
- attrib.exe -p +u $file # Mark as online and remove the file
- attrib.exe -p -u $file # Mark as online, but keep the file
- attrib.exe +p +o $file # Mark as offline and download
|