I am using a PowerShell script to delete data.
Where I do not have access I am using SubInACL.exe to take\set ownership
Note: I then call it again to grant access
Note II: I am aware of TakeOwn.exe and use it elsewhere in the script
I build the command using a here-string:
[string]$SubInACLCommand = @"
subinacl.exe /file "$func_filePath" /setowner="Hostname\Administrators"
"@
Then call it using Invoke-Expression:
Invoke-Expression $SubInACLCommand
The output is returned double-spaced:
\ \ H o s t n a m e \ S h a r e n a m e \ F o l d e r n a m e : H o s t n a m e \ A d m i n i s t r a t o r s i s t h e n e w o w n e r
...
I have not seen this before. It is as if the output is in some 16-bit character set, where PowerShell ISE is expecting\interpreting it as 8-bit.
This is not causing me a problem as such. However any insight would be appreciated as it would be nice to understand and even better to correct.