You can Also put this A GPO \ Computer config \ Startup
and enjoy
Main Topics
Browse All TopicsHello,
I am looking for a solution to create a vbscript that will do the following:
Check if a particular folder exists on the target pc. If that folder exists, exit and do nothing. If the folder does not exist, rename another folder in that same directory and then run an .msi installer.
To be more specific...
I want to see if C:\Program Files\Microsoft Business Solutions\Great Plains Old 3 exists...if so do nothing.
If not, I want to rename C:\Program Files\Microsoft Business Solutions\Great Plains to C:\Program Files\Microsoft Business Solutions\Great Plains Old 3 and then execute a packaged .msi file. Also, I would like to do this via a group policy object if possible.
Thanks for any help on this one.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This VB Script should do the job for you. Hope it helps:
Option Explicit
Dim oWMI, oFolder, oFCheck
Dim ColFolders, colFCheck
Dim errResults
Dim strComputer, strFname, strFRename, strFCheck
strComputer = "TESTPC" ' Name of remote computer ... name does not need \\
strFCheck = "C:\\temp\\not here" ' Name of folder to check exists ... needs double \\
strFname = "C:\\temp\\test" ' Folder of which to rename ... needs double \\
strFRename = "C:\temp\test rename" ' New folder name ... standard path format
' ============= Connect to remote machine ================
Set oWMI = GetObject("winmgmts:" & "{impersonationLevel=imper
' ============= Check if folder exists ===================
Set colFCheck = oWMI.ExecQuery ("Select * from Win32_Directory where name = '" & strFCheck & "'")
IF colFCheck.Count = 0 Then
'============= Folder does not exist ===================
Set colFolders = oWMI.ExecQuery ("Select * from Win32_Directory where name = '" & strFname & "'")
For Each oFolder in colFolders
errResults = oFolder.Rename(strDrive & strFRename)
Next
Else
'============ Folder Exists ... Do Nothing ===============
End IF
Business Accounts
Answer for Membership
by: HousammuhannaPosted on 2008-08-04 at 12:43:25ID: 22155432
YESSSSSSS for sure
You can
I Do it using a BAT file
easier to understand
Here is the code
@echo off
Echo I am going to do a Folder check
if exist "C:\Program Files\Microsoft Business Solutions\Great Plains Old 3" goto hell
ren "C:\Program Files\Microsoft Business Solutions\Great Plains" "Great Plains Old 3"
C:\MyMSI.MSI
:hell