Hi,

I am currently writng a platform validation tool that will run post server
build from a remote server. In order to make it OS version agnostic I need to
remotely query local system variables - specifically %SYSTEMROOT%.

As it wont be run locally I can't use "objShell.ExpandEnvironmentStrings" so
I have been trying the "Win32_Environment" wmi class. Only issue is that
this seems to only return variables under
"HKLM\System\CurrentControlSet\Control\
Sessionmanager\Environment" of which %SYSTEMROOT% is not there?

I have searched the registry and can't seem to find any reference of where
this get set.

Does anybody have any idea or functions that can recieve this information?

Basically I need to mimic the functionality of
"objShell.ExpandEnvironmentStrings" but remotely.

Thanks,
Rob

RE: Remotely query system variables? by r_tesoriero

r_tesoriero
Thu Apr 13 05:56:02 CDT 2006

PS: I am currently using this, but it's kind a single use pointless function.
I really want something that can do all remote system variables rather than
needing two separate functions.

Function GetRemoteWinDir(strServer)

Dim objWMIService
Dim colOS
Dim objOS

Set objWMIService = GetObject("winmgmts:\\" & strServer & "\root\cimv2")
Set colOS = objWMIService.ExecQuery("Select SystemDirectory from
Win32_OperatingSystem")
For Each objOS in colOS
GetRemoteWinDir = Replace(objOS.SystemDirectory, "\system32", "")
Next

Set objWMIService = Nothing

End Function

"RobT" wrote:

> Hi,
>
> I am currently writng a platform validation tool that will run post server
> build from a remote server. In order to make it OS version agnostic I need to
> remotely query local system variables - specifically %SYSTEMROOT%.
>
> As it wont be run locally I can't use "objShell.ExpandEnvironmentStrings" so
> I have been trying the "Win32_Environment" wmi class. Only issue is that
> this seems to only return variables under
> "HKLM\System\CurrentControlSet\Control\
> Sessionmanager\Environment" of which %SYSTEMROOT% is not there?
>
> I have searched the registry and can't seem to find any reference of where
> this get set.
>
> Does anybody have any idea or functions that can recieve this information?
>
> Basically I need to mimic the functionality of
> "objShell.ExpandEnvironmentStrings" but remotely.
>
> Thanks,
> Rob

Re: Remotely query system variables? by Jerold

Jerold
Thu Apr 13 06:12:23 CDT 2006

On Thu, 13 Apr 2006 02:14:01 -0700, RobT <r_tesoriero@hotmail.com.(donotspam)> wrote:

>Hi,
>
>I am currently writng a platform validation tool that will run post server
>build from a remote server. In order to make it OS version agnostic I need to
>remotely query local system variables - specifically %SYSTEMROOT%.
>
>As it wont be run locally I can't use "objShell.ExpandEnvironmentStrings" so
>I have been trying the "Win32_Environment" wmi class. Only issue is that
>this seems to only return variables under
>"HKLM\System\CurrentControlSet\Control\
> Sessionmanager\Environment" of which %SYSTEMROOT% is not there?
>
>I have searched the registry and can't seem to find any reference of where
>this get set.
>
>Does anybody have any idea or functions that can recieve this information?
>
>Basically I need to mimic the functionality of
>"objShell.ExpandEnvironmentStrings" but remotely.
>
>Thanks,
>Rob


The SystemRoot Value Name, a string data type at
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com

Re: Remotely query system variables? by r_tesoriero

r_tesoriero
Thu Apr 13 06:43:02 CDT 2006

Cheers, found it, thanks!

That makes things a bit easier.

-Rob

"Jerold Schulman" wrote:

> On Thu, 13 Apr 2006 02:14:01 -0700, RobT <r_tesoriero@hotmail.com.(donotspam)> wrote:
>
> >Hi,
> >
> >I am currently writng a platform validation tool that will run post server
> >build from a remote server. In order to make it OS version agnostic I need to
> >remotely query local system variables - specifically %SYSTEMROOT%.
> >
> >As it wont be run locally I can't use "objShell.ExpandEnvironmentStrings" so
> >I have been trying the "Win32_Environment" wmi class. Only issue is that
> >this seems to only return variables under
> >"HKLM\System\CurrentControlSet\Control\
> > Sessionmanager\Environment" of which %SYSTEMROOT% is not there?
> >
> >I have searched the registry and can't seem to find any reference of where
> >this get set.
> >
> >Does anybody have any idea or functions that can recieve this information?
> >
> >Basically I need to mimic the functionality of
> >"objShell.ExpandEnvironmentStrings" but remotely.
> >
> >Thanks,
> >Rob
>
>
> The SystemRoot Value Name, a string data type at
> "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
>
> Jerold Schulman
> Windows Server MVP
> JSI, Inc.
> http://www.jsiinc.com
> http://www.jsifaq.com
>