Hi, I have a VB script that I want ran from a batch file. How do I go about this? See the VBscript below:
Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" ) Dim sSrcDir : sSrcDir = "//serverNameFBSurvey" ' Source directory (remote server) Dim sDstDir : sDstDir = "c:SampleDir" & "" ' Destination directory WScript.Echo "sSrcDir:", sSrcDir WScript.Echo "sDstDir:", sDstDir If Not oFS.FolderExists( sDstDir ) Then oFS.CreateFolder sDstDir ' Creates the destination directory if it doesnt already exist Else WScript.Echo "Deleting folder ...", sFSpec Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.DeleteFolder("C:SampleDir") oFS.CreateFolder sDstDir ' reCreates the destination directory if it doesnt already exist End If Dim oSrcFiles : Set oSrcFiles = oFS.GetFolder( sSrcDir ).Files Dim oFile, sFSpec For Each oFile In oSrcFiles WScript.Echo "Src ", oFile.Path sFSpec = sDstDir & oFile.Name If oFS.FileExists( sFSpec ) Then Set objFSO = CreateObject("Scripting.FileSystemObject") WScript.Echo "File already exists", sFSpec If oFile.DateLastModified > oFS.GetFile( sFSpec ).DateLastModified Then WScript.Echo "Cpy (D)", sFSpec oFile.Copy sFSpec End If Else WScript.Echo "Cpy (N)", sFSpec oFile.Copy sFSpec End If Next Set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo "Initializing the survey application...." WshShell.Run "C:SampleDirFB_Survey.exe"
I want this script to be attached to all staff's profile on the domain from the domain's controller and called during logon by staff.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!