We had a major storm through here recently and we suffered damage to the house roof and ceilings. I just received the quote to repair. I’m hoping that a small fraction of the 80,000 odd people that download SDIO and/or Desktop Info every month won’t mind chipping in a few dollars to help out. Click on the big blue button at the bottom of the page to help us keep a roof over our heads, literally!
Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.
Greetings,
It has been years since I looked for updates to this fine product and boy was I surprised on how much activity there has been!
I'm still trying to understand the new syntax for the .ini files. One thing that has changed is the OS Version display. It now uses a WMI call. Is there a way to parse the %caption% response so I can pull just the bits I want?
For example namespace:rootcimv2,query:Win32_OperatingSystem,display:%caption% will show
"Microsoft Windows Server 2019 Standard"
Let's say that I don't care if it shows Microsoft and want to omit it from the display. Is that possible?
Thanks!
Not right now.
The thought started the brain ticking over though.
Idea 1: I can imagine a substring tool for example. substr(string,start,length)
display: {{subtr(%caption%,11)}}
Idea 2: A tool that breaks down a string field into words. Your example would produce 5 new fields: %caption_1%, %caption_2% etc. You can then display %caption_3% %caption_4% %caption_5%. You would have to know what the output of the original string field looks like. I'll have to give implementation some more thought.
This is kind of what I'm looking for but not sure if REGEX can be used in the .ini
https://stackoverflow.com/questions/27306449/powershell-gwmi-win32-operatingsystem-trim-output
Possibly, but I don't have a good grasp of regex, I've tried but it eludes me.
Since the OS Version ini option now uses an WMI call, the added "Microsoft" text really messes with my right column mojo.
This PS script really returns what I'm hoping to have
gwmi Win32_OperatingSystem | % Caption | % split ' ' 2 | select -last 1
Oh well, guess I just need to be patient and see what v2.5 will bring. 🙂
There you go, problem solved:
CMD=text:Windows,file:powershell.exe,parameters:gwmi Win32_OperatingSystem | % Caption | % split ' ' 2 | select -last 1
Oh boy! So close. Now if I can tag on
gwmi Win32_OperatingSystem | % OSArchitecture
or
WMI=namespace:rootcimv2,query:Win32_OperatingSystem,display:%OSArchitecture%
at the end, I think life will be good again. 🙂
Allow me to explain.
Before we had it show the following:
Windows Server 2019 (64-Bit)
With the cool new CMD feature you showed me, I can get
Windows Server 2019
Can the %OSArchitecture% somehow be appended to the end of the command you sent? Or maybe can "gwmi Win32_OperatingSystem | % OSArchitecture" type code be used on the left column along with a little text?
If not, not a big deal but thought I'd ask. 🙂
you use user variables. you have two commands, each sets a user variable. a third command displays the user variables.
CMD=text:Windows,file:powershell.exe,parameters:gwmi Win32_OperatingSystem | % Caption | % split ‘ ‘ 2 | select -last 1,set:win32_os,hidden:1
WMI=namespace:rootcimv2,query:Win32_OperatingSystem,display:%OSArchitecture%,set:win32_arch,hidden:1
text=display:%win32_os% (%win32_arch%)
unfortunately Powershell appends a line feed to it's output. Your task is to figure out how to strip that trailing line feed from the output.
OK, I think I have some alternate PS script that will output what I would like sans CR/LF
$Computer = gwmi Win32_operatingSystem | Select-Object Caption, OSArchitecture
$Computer = "$($Computer.Caption) ($($Computer.OSArchitecture))" | % {$_.replace("Microsoft ","")}
$ComputerI've distilled it to 2 lines. The last (3rd) line is just to show the output in PS.
I can't quite figure out how to DesktopInfo'ize it so that it will work in the .ini. 🙁
you just have to get it to a single line command or put it in a script file and call the script file from DTI
Couldn't get it whittled down to 1 line. 🙁 I resorted to having it call the script and all looks as it should. Quite the work around but it is what it is.
Thanks!
