/build/static/layout/Breadcrumb_cap_w.png

Change Powershell Script to VB Script

Hello, I am completely new to VB scripting.  I have a powershell script that needs to work in VB.  Here is the powershell version:

 

$version = Get-FileVersionInfo C:\ProgramData\folder*\filename.exe
if ($version.FileVersion -like '10.5.8*')
    {return $version.FileVersion}
    else
    {}

Summary of script: There is an executable (filename.exe) that lives in c:\ProgramData\foldername.  The full path to the .exe is different on every installation, so it could be in c:\programdata\foldername1234\filename.exe, or c:\programdata\foldername2345\filename.exe, etc.

I need to check the file version of the .exe, see if its like a certain version, if so, return the version number, if not, return null.

Any help would be FANTASTIC!!!


2 Comments   [ + ] Show comments
  • Try this:

    http://www.activexperts.com/network-monitor/windowsmanagement/adminscripts/ - 786_ak 9 years ago
  • 'vbscript
    Dim file1
    Dim version

    FILE1 = "C:\ProgramData\folder*\filename.exe"
    version = ("10.5.8*")

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If objFSO.GetFileVersion(FILE1) - like version Then
    WshShell.run(path To executable)
    end if - hvasudeva 8 years ago

Answers (1)

Posted by: hvasudeva 8 years ago
White Belt
0

This will help you :)


'vbscript

Dim file1

Dim version

FILE1 = "C:\ProgramData\folder*\filename.exe"

version = ("10.5.8*")

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.GetFileVersion(FILE1) - like version Then

WshShell.run(path To executable)

end if

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ