If, however, we run the script manually by double clicking on it, it works just fine (removes linked PST from outlook). We tried it with wow64 redirection but also no luck. Seems like a rights issue? Not sure if anyone else has run into this.
These are the contents of the VBS for reference:
On Error Resume Next
Dim objOutlook 'As Outlook.Application
Dim Stores 'As Outlook.Stores
Dim objFolder 'As Outlook.Folder
Dim i 'As Integer
Set objOutlook = CreateObject(âOutlook.Applicationâ)
Set Stores = objOutlook.Session.Stores
For i = Stores.Count to 0 step -1
If Stores(i).ExchangeStoreType = 3 Then
Set objFolder = Stores(i).GetRootFolder
objOutlook.Session.RemoveStore objFolder
Else
End If
I would try just using create file to create the file and run it:
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
delete __createfile
// CREATEFILE
createfile until END_OF_FILE
On Error Resume Next
Dim objOutlook 'As Outlook.Application
Dim Stores 'As Outlook.Stores
Dim objFolder 'As Outlook.Folder
Dim i 'As Integer
Set objOutlook = CreateObject(âOutlook.Applicationâ)
Set Stores = objOutlook.Session.Stores
For i = Stores.Count to 0 step -1
If Stores(i).ExchangeStoreType = 3 Then
Set objFolder = Stores(i).GetRootFolder
objOutlook.Session.RemoveStore objFolder
Else
End If
END_OF_FILE
Also tried the new script (via Fixlet Debugger) - didnât work. I should add that I tried an equivalent powershell script but it too didnât work, which further leads me to believe itâs some kind of access issue.
override wait
completion=job
hidden=true
runas=currentuser
wait { pathname of file ((it as string) of value âPathâ of key âHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShellâ of native registry) } -ExecutionPolicy Bypass -File "c:\temp\RemovePST.ps1"
delete âc:\temp\RemovePST.ps1â
// remove temp folder if it is empty
if {exists folder âc:\tempâ whose (not exists files of it and not exists folders of it)}
folder delete "c:\temp"
endif
Unfortunately it still doesnât work. It runs like the the others but the PSTs do not get unlinked/disconnected. Have you tried it on your own (with your own PSTs) by any chance? This is very weirdâŚ
@cjwolford thanks very much - what I was missing was this:
waithidden â{pathname of system folder & â\icacls.exeâ}â âc:\temp\RemovePST.ps1â /grant Everyone:F
It was a rights issue as I suspected, I just didnât realize the agent wouldnât be able to access it since it created the file itself. Only tested it once and it works but Iâll confirm. Thanks again!
I have followed all the steps that apply to my vbscript and Iâm still not having any success with running my vbscript as a custom task.
@cjwolford I definitely followed your steps and running it manually makes the changes to the .txt file but when I incorporate bigfix via the fixlet debugger the result is Evaluation Failed - The system cannot find the file specified.
delete _createfile
//CREATEFILE
createfile until END_OF_FILE
'Instantiate shell object
set objshell = Wscript.CreateObject(âWscript.Shellâ)
'Instantiate file system object
Set objFSO = CreateObject(âScripting.FileSystemObjectâ)
Set objFSO = CreateObject(âScripting.FileSystemObjectâ)
Set objFile = objFSO.OpenTextFile(âC:\ProgramData\Avid\MediaCentralUX\config.txtâ, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, âThis not the Endâ, âHello Friendsâ)
Set objFile = objFSO.OpenTextFile(âC:\ProgramData\Avid\MediaCentralUX\config.txtâ, ForWriting)
objFile.WriteLine strNewText
objFile.Close
END_OF_FILE
thank you so much @JasonWalker, the action now completes in the fixlet debugger but using:
delete __createfile
//CREATEFILE
createfile until END_OF_FILE
'Instantiate shell object
set objshell = Wscript.CreateObject(âWscript.Shellâ)
'Instantiate file system object
Set objFSO = CreateObject(âScripting.FileSystemObjectâ)
Set objFSO = CreateObject(âScripting.FileSystemObjectâ)
Set objFile = objFSO.OpenTextFile(âC:\ProgramData\Avid\MediaCentralUX\config.txtâ, ForReading)
Check that you arenât using any "smart quotes" in the VBScript. They are appearing as âsmart quotesâ as youâve posted them here, but Iâm not sure whether thatâs the forum reformatting your quotes, or if they are that way in your actual actionscript.
No smart quotes but the text inside the file still isnât being replaced? Bigfix doesnât like something? Again any assistance is greatly appreciated.
This is a case where you really need to test your VBScript before trying to deploy it with BigFix. The problem here isnât BigFix or your action script, itâs that your VBScript does not work.
You havenât defined the constants ForReading or ForWriting that your script is using with the OpenTextFile methods.