Search code examples
vbscriptsccmtnsnames

tnsnames vbscript via SCCM - environment variables failing


I am trying to update a tnsnames.ora file with a vbscript that is deployed via SCCM. On my packaging machine, the file runs without error, but when the script is run on a test machine via SCCM install, the script is unable to find the location of the file that uses the TNS_ADMIN variable. I have verified exists on both the test install machine.

Code failing:

Origfile = WshShell.ExpandEnvironmentStrings("%TNS_ADMIN%") & "\tnsnames.ora"

' TNSNames.ora exists ?
If Not FSO.FileExists(Origfile) Then
    LogFile.WriteLine(now & " - TNSNames.ora not found")
    LogFile.WriteLine(now & " Original File: " & OrigFile & " - TNSNames.ora not found")
    LogFile.Close
    wscript.quit
Else
    LogFile.WriteLine(now & " - " & OrigFile & " found")
End If

Echo Result:

3/9/2015 4:06:57 PM - TNSNames.ora not found 3/9/2015 4:06:57 PMOriginal File: %TNS_ADMIN%\tnsnames.ora - TNSNames.ora not found

Does anyone know how I can get it to see the environment variables?

Solution

  • Did a work around by using Smart Packager 2.0 to package an empty MSI then added a custom feature to run the Vbscript and deploying the msi instead of going the non-msi route. The problem seems to be that the vbscripts environment scope is that of the processing machine, not the targeted and since it wasnt an MSI file it wasnt downloading to the client