I am trying to use an environment variable in a custom script. I am trying to reference the variable from the computer's inventory record in the Environment - Variable - ProgramFiles section. The script isn't subsistituting the value contained in this item. Has anyone used one of these inventory items in a custom script? I appreciate the help and I am sure that this is just something obvious that I am overlooking.
Are you talking about Managed Scripts or Security and Patch Manager? Also, which version, and service pack? Be sure to use the Tags section in the first post to help.
8.8 SP3 and managed scripts.
From what I've seen and done, the "%programfiles%" variable does not work when called via a Remote Execute such as this
The only way I've done it, is via calling a VBScript that went to the location needed, or called the specific application.
strProgramFiles = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%programfiles%")
Set WshShell = WScript.CreateObject("WScript.Shell")
rc = WshShell.Run("notepad.exe " & strProgramFiles & "\script.txt",, True)
' You can also run applications
' Remember that QUOTES are needed if the path contains a SPACE
rc = WshShell.Run("""" & strProgramFiles & "\Windows Media Player\wmplayer.exe" & """",, True)
Hope that points you in the right direction.