Create File Fails on VBS script due to relevance substitution failure (but I don't want to do relevance substitution)

(imported topic written by IvyC)

I’m trying to use create file to create the below VBS script. The script works well when i create/run it manually. However, when createfile attempts to create it. it fails on the line “Set objReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\.\root\default:StdRegProv”)” . The problem is the {}… it says “relevance substitution failed” but i don’t want to do relevance substitution. How do I tell BigFix that?

Const strDefKey = &H80000002 ’ HKEY_LOCAL_MACHINE

Const strSubKeyName = “SOFTWARE\USPS\DCS”

Const strValueName = “TimeServAddressList”

Const strAddValue = “10.10.255.255”

’ Obtain registry object

Set objReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\.\root\default:StdRegProv”)

’ Query existing value

If objReg.GetMultiStringValue(strDefKey, strSubKeyName, strValueName, arrValues) <> 0 Then WScript.Quit(1)

’ Check if the value to be added is already present

For Each strItem in arrValues

If strItem = strAddValue Then WScript.Quit(0)

Next

’ Add value to array

ReDim Preserve arrValues(UBound(arrValues) + 1)

arrValues(UBound(arrValues)) = strAddValue

’ Write array to registry

If objReg.SetMultiStringValue(strDefKey, strSubKeyName, strValueName, arrValues) <> 0 Then WScript.Quit(1)

(imported comment written by BrianPGreen)

It’s interpreting the open curly brace “{” as starting a relevance substitution. To escape it, you have to put two curly braces like {{.