none
Turn a VBScript into powershell RRS feed

  • Question

  • Below is a VBScript I received to run for a uninstall of a application, long story short I can not run this as is, I will need it as a batch file or as a powershell script. Is there a way to convert this into powershell?

    On Error Resume Next

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set wshShell = CreateObject("WScript.Shell")

    Set objEnv = wshShell.Environment("PROCESS")
    objEnv("SEE_MASK_NOZONECHECKS") = 1

    'Kill citrix apps
    wshShell.Run"taskkill /t /im wfica32.exe /im Receiver.exe /f /im wfcrun32.exe /im pnamain.exe /im concentr.exe",,True
     
    'Remove via Ctrl Panel
    If objFSO.FileExists("C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe") Then
     wshShell.Run """C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe"" /uninstall /cleanup /silent",1,True
    End If

    'Remove via Citrix utility
    wshShell.Run(strScriptFolder & "\ReceiverCleanupUtility.exe /silent"),0,True

    'Check for successful removal
    If objFSO.FileExists("C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe") Then
     'Failed
    End If

    Monday, November 16, 2015 2:13 PM

Answers

  • When you have a closer look at this script then you'll notice that it contains nothing other than a bunch of console commands wrapped in some VBScript code. Removing the unnecessary rubbish yields this simple batch file:

    @echo off
    taskkill /t /im wfica32.exe /im Receiver.exe /f /im wfcrun32.exe /im pnamain.exe /im concentr.exe

    if exist "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" /uninstall /cleanup /silent

    "???\ReceiverCleanupUtility.exe" /silent
    if exist "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" echo Failed

    The script uses the undefined variable strScriptFolder. You need to find out what it is and put it into the place of the three question marks ???.

    Monday, November 16, 2015 3:07 PM

All replies

  • When you have a closer look at this script then you'll notice that it contains nothing other than a bunch of console commands wrapped in some VBScript code. Removing the unnecessary rubbish yields this simple batch file:

    @echo off
    taskkill /t /im wfica32.exe /im Receiver.exe /f /im wfcrun32.exe /im pnamain.exe /im concentr.exe

    if exist "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" /uninstall /cleanup /silent

    "???\ReceiverCleanupUtility.exe" /silent
    if exist "C:\ProgramData\Citrix\Citrix online plug-in\TrolleyExpress.exe" echo Failed

    The script uses the undefined variable strScriptFolder. You need to find out what it is and put it into the place of the three question marks ???.

    Monday, November 16, 2015 3:07 PM
  • Thank you, this worked great.
    Monday, November 16, 2015 3:27 PM