I'll give that a try too...luckily the software I am using means it is no
problem to ensure the Registry key exists before running my script :-)




On 16 April 2013 17:18, Ben Scott <[email protected]> wrote:

> On Tue, Apr 16, 2013 at 12:00 PM, Ben Scott <[email protected]> wrote:
> >   I'm having trouble figuring out how to get the regexp capture out of
> > the $match object returned by Select-String though.
>
>   Ah, okay, this seems to work:
>
> $match = & CTXCliOS.exe | Select-String -Pattern 'ClientOS\s+(.+)'
> if($match) {
>         $clientOS = $match.Matches[0].Groups[1].Value
>         Set-ItemProperty -Path 'HKCU:\Software\Custom' -Name ClientOS
> -Value $clientOS
> }
>
>   You'll want to test that.  :)  In particular, I expect it will fail
> miserably if the "Custom" subkey doesn't exist yet.
>
>   For reasons I don't understand, $match.Matches[0].Groups[0] appears
> to be a reference to itself.
>
> -- Ben
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
> ---
> To manage subscriptions click here:
> http://lyris.sunbelt-software.com/read/my_forums/
> or send an email to [email protected]
> with the body: unsubscribe ntsysadmin
>



-- 
*James Rankin*
Technical Consultant (ACA, CCA, MCTS)
http://appsensebigot.blogspot.co.uk

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to