Const
cVbsFile =
"testExtension.vbs"
Const
cHKEY_LOCAL_MACHINE = &H80000002
Set
oReg=GetObject(
"winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv"
)
oReg.GetStringValue cHKEY_LOCAL_MACHINE,
"SOFTWARE\Microsoft\ConfigMgr\Setup"
,
"UI Installation Directory"
, sSccmPath
Set
oReg =
Nothing
sSourcePath = Replace(WScript.ScriptFullName, WScript.ScriptName,
""
)
Set
oShell = CreateObject(
"WScript.Shell"
)
Set
oFso = CreateObject(
"Scripting.FileSystemObject"
)
Set
oFile = oFso.OpenTextFile(sSccmPath &
"\XmlStorage\ConsoleRoot\AdminConsole.xml"
, 1)
Do
While
oFile.AtEndOfStream <>
True
sText = Trim(uCase(oFile.ReadLine))
If
InStr(sText,
"NAMESPACEGUID="
)
Then
sGuid = sText
sGuid = Right(sGuid, Len(sGuid) - InStr(sGuid,
"NAMESPACEGUID="
) - 14)
sGuid = Left(sGuid, InStr(sGuid,
""
""
)-1)
if not oFso.FolderExists(sSourcePath & sGuid)
Then
WScript.Echo sSourcePath & sGuid
oFso.CreateFolder sSourcePath & sGuid
Set
oXmlFile = oFso.CreateTextFile(oShell.ExpandEnvironmentStrings(
"%TEMP%\snowland-guid-locator.xml"
),
True
)
oXmlFile.WriteLine
"<actiondescription class="
" executable="
" displayname="
" guid="
" sguid="
" mnemonicdisplayname="
" locator="
" description="
" snowland.se="
">"
oXmlFile.WriteLine
"<executable>"
oXmlFile.WriteLine
"<filepath>"
& sSourcePath & cVbsFile &
"</filepath>"
oXmlFile.WriteLine
"<parameters>"
& sGuid &
" ##Sub:Name## ##Sub:ResourceID## ##SUB:ItemName## ##SUB:NetworkOSPath## ##SUB:value##</parameters>"
oXmlFile.WriteLine
"</executable>"
oXmlFile.WriteLine
"</actiondescription>"
oXmlFile.Close
oFso.CopyFile oShell.ExpandEnvironmentStrings(
"%TEMP%\snowland-guid-locator.xml"
), sSourcePath & sGuid &
"\snowland-"
& sGuid &
".xml"
End
if
End
If
Loop
oFile.Close