leider ist es mir nicht gelungen einen VBS Script in OPSI durchzuführen.
Ich habe viele sachen ausprobiert doch leider kam ich nicht zum ergebnis.
Setup.opsiscript
Code: Alles auswählen
Message = Bitte warten, das Produkt wird installiert
setLogLevel = 3
ExitOnError = false
ScriptErrorMessages = on
TraceMode = off
StayOnTop = false
[Actions]
requiredWinstVersion >= "4.11"
DefVar $ProductId$
DefVar $ProductName$
DefVar $ExitCode$
DefVar $LogDir$
Set $LogDir$ = "%SystemDrive%\tmp" + $ProductID$
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "Script"
; ----------------------------------------------------------------
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
ExecWith_VBS "%SystemDrive%\Windows\System32\cscript.exe"
[ExecWith_VBS]
1.times do
"%ScriptPath%\ps_config.vbs"
end
script.vbs
Code: Alles auswählen
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
Const ForWriting = 2
' Datei öffnen und Text einlesen und schließen
Set objFile = objFSO.OpenTextFile("C:\ProgramData\PROGRAM\SystemConfiguration.xml", ForReading)
strText = objFile.ReadAll
objFile.Close
' Änderungen am Inhalt
strNewText = Replace(strText, """", "'")
strNewText = Replace(strNewText, "NAME", "IP")
' Neue Datei erstellen mit neuen Inhalten füllen
set resultFile = objFSO.CreateTextFile("C:\ProgramData\PROGRAM\SystemConfiguration.xml", true)
resultFile.WriteLine strNewText
resultFile.Close
if InStr(1, strNewText, "IP", 1) > 0 Then
MsgBox "Erfolgreich",VBOKOnly,""
else
MsgBox "Fehlgeschlagen",VBOKOnly,""
end if
Hat jemand eine Idee wie ich das Script zum laufen bekomme.
VG
NeZoX