Start-Process gives you complete control over executing a separate task.
If you don't need complete control, but just the text output, you don't need to
do anything.
$result = CTXCliOS.exe ^ | find "ClientOS"
You can make it more PowerShell, if you want, but there isn't much value in
doing so. (If you want to start talking about into making it an "Enterprise
Class" script, then that changes things dramatically. Ask Web about the things
I've shown him the last year.) :)
From: James Rankin [mailto:[email protected]]
Sent: Tuesday, April 16, 2013 11:06 AM
To: NT System Admin Issues
Subject: PowerShell noob help
I've got a batch script I've been using for a while to identify the flavour of
client connecting to a XenApp or XenDesktop session. It uses an executable
called CTXCliOS.exe
Basically this is the batch
for /f "tokens=2 delims==" %%a in ('CTXCliOS.exe ^| find "ClientOS"') do set
ClientOS=%%a& call :SET
goto :eof
:SET
reg add HKCU\Software\Custom /v ClientOS /t REG_SZ /d %ClientOS% /f
goto :eof
I'm sure you get the picture.
What I'm wondering is what format do I use to convert this to PowerShell (which
will avoid having to invoke a separate command script file)? What's the command
to call an outside executable (I can't seem to dig it up, but I am on a network
where just about every helpful site is blocked by the web filter, so don't be
too hard on me, please!)
Thanks in advance,
--
James Rankin
Technical Consultant (ACA, CCA, MCTS)
http://appsensebigot.blogspot.co.uk<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]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin
~ 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