Ok, I've came up against a problem which has near enough taken all my hair from me today!
I'm in the middle of writing a little function to check that we have set screensavers correctly across our server estate. After some process monitoring, I seen that these settings are written to a policy file:
So it seems easy enough, import the content, chop it up into a nice PS Object and from there check if it's set correctly. The problem seem to be spaces, are not being recognised as spaces!
$Content = Get-Content .Registry.pol
if I return $Content I get output like:
[ S o f t w a r e P o l i c i e s M i c r o s o f t W i n d o w s C o n t r o l P a n e l D e s k t
o p ; S C R N S A V E . E X E ; ☺ ; ¶ ; l o g o n . s c r ]
I thought, that with this only being string data I could so a simple replace(" ","") but the only space that is recognised is the extra space between "Control Panel"
I'm at my wits end with this one now!