Get PC Model

Antworten
bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Get PC Model

Beitrag von bobzbobz »

Hi

I am trying to make a package of VMware Tools.

I want the setup-script to check if the PC-model is set to "VMware Virtual Platform" to determine if the PC is virtual.

I am trying to do this by using the commands:

Code: Alles auswählen

DefStringList $list$
Set $list$ = getOutStreamFromSection("DosInAnIcon_getmodel")

<more code>

if (takeFirstStringContaining($list$,"VMware") = "VMware Virtual Platform")
do something...

<more code>

[DosInAnIcon_getmodel]
wmic computersystem get model
If i run the command "wmic computersystem get model" on the virtual client i get this output:

Code: Alles auswählen

Model
VMware Virtual Platform
This is the definition of the takeFirst... command defined in the winst-manual:
takeFirstStringContaining(<list>,<search string>)
returns the first string of the list which contains the <search string>.
Returns an empty string if no matching string was found.
Shouldent my code work? It doesnt..

Best Regards,
Soren
bobzbobz
Beiträge: 169
Registriert: 30 Nov 2012, 10:41
Wohnort: Denmark

Re: Get PC Model

Beitrag von bobzbobz »

Okay, i solved it...

added

Code: Alles auswählen

DefStringList $list$
DefVar $PCModel$

Set $list$ = getOutStreamFromSection("DosInAnIcon_getmodel")
Set $PCModel$ = takeFirstStringContaining($list$,"VMware")

<more code>

if contains($PCModel$, "VMware")
do something...

<more code>

[DosInAnIcon_getmodel]
wmic computersystem get model
Antworten