shell - WSHShell on WinServer 2012. ExpandEnvironmentStrings doesn't return %computername% and %sessionname% variables -
shell - WSHShell on WinServer 2012. ExpandEnvironmentStrings doesn't return %computername% and %sessionname% variables -
i'm taking script supposed homecoming %computername% , %sessionname% environment variables. i'm running script on winserver 2008 , works fine. i'm running same script on winserver 2012 , doesn't work. returns "%computername%" , "%sessionname%" instead of values of variables. i've tested script other environment variables have found in "system variables" alternative menu , works fine. there trickiness in winserver 2012 function , particular variables?
p.s. when create "echo %computername%" , "echo %sessionname%" in cmd, returns right values.
thanks in advance!
ive ran next vbs on server 2012 standart 6.2.9200 n/a build 9200
set wshshell = createobject( "wscript.shell" ) wscript.echo wshshell.expandenvironmentstrings( "%computername%" ) wscript.echo wshshell.expandenvironmentstrings( "%sessionname%" ) i got in homecoming values server/session, im guessing os isnt issue here.. have tried typing set in command line , see if variables initilize values expect them be?
there way of getting env vars shell
wscript.echo wshshell.environment("process").item("computername") notice in method, can , should specify scope of environment variable
shell environment-variables windows-server-2012 wsh
Comments
Post a Comment