I have a Vbs that is ok when user is administrator of the machine, I need to run this script as domain admin.
I think in call this script or imput a account and password in this script.
The script is:
Set WshShell = WScript.CreateObject("WScript.Shell")Set objFSO = CreateObject("Scripting.FileSystemObject")
Const OverWriteFiles = True
strTempDir = WshShell.ExpandEnvironmentStrings("%TEMP%")
strAppDataDir = WshShell.ExpandEnvironmentStrings("%APPDATA%")
strFirefoxProfilesDir = strAppDataDir & "\Mozilla\Firefox\Profiles"
'------------------------------------------------------
strCertutilFolder = "Network path"
strLocalCertificateAuthorityName = "FortiGate CA"
strCertificateFileName = "FortiGateCA.crt"
strTrustAttributes = "CT,c,C"
'------------------------------------------------------
If objFSO.FolderExists(strFirefoxProfilesDir) Then
objFSO.CopyFolder strCertutilFolder, strTempDir & "\FirefoxTools", OverWriteFiles
Set arrFirefoxProfileList = objFSO.GetFolder(strFirefoxProfilesDir).SubFolders
For Each FireFoxProfile In arrFirefoxProfileList
objFSO.CopyFile FireFoxProfile & "\cert8.db" , FireFoxProfile & "\cert8.db.old", OverWriteFiles
Call WshShell.Run(strTempDir & "\FirefoxTools\certutil -A -n " & Chr(34) & strLocalCertificateAuthorityName & Chr(34) & " -i " & strTempDir & "\FirefoxTools\" & strCertificateFileName & " -t " & Chr(34) & strTrustAttributes & Chr(34) & " -d " & Chr(34) & FireFoxProfile & Chr(34), 0, true)
Next
objFSO.DeleteFolder(strTempDir & "\FirefoxTools")
End If
'------------------------------------------------------
Function IsInstalled(strSoftwareName)
IsInstalled = FALSE
On Error Resume Next
const HKEY_LOCAL_MACHINE = &H80000002
Set colEnvironment = WshShell.Environment("PROCESS")
If colEnvironment("ProgramFiles(x86)") <> "" Then
arrWOW6432NODE= Array("WOW6432NODE\","")
Else
arrWOW6432NODE= Array("")
End If
For Each Wow6432Node In arrWOW6432NODE
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\" & Wow6432Node & "Microsoft\Windows\CurrentVersion\Uninstall"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
InstalledSWName = WshShell.RegRead("HKLM\" & strKeyPath & "\" & subkey & "\DisplayName")
If InStr(InstalledSWName, strSoftwareName) > 0 Then
IsInstalled = TRUE
Exit For
End If
Next
Next
End Function