Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

Need help adding a progess bar to code

Home Forums Scripting Windows Script Host Need help adding a progess bar to code

Viewing 1 post (of 1 total)
  • Author

  • vane0326

    Hi everyone,

    Just to let everyone know that my original account “Shazam” is somehow not working. I’m not able to logon. I sent a private message to the Administrator regarding this issue. In the meanwhile I created another account so I can post a question here. Hopefully I’m not offending anyone.
    Back to my question…

    I have this VBScript below. It will copy a folder from the source location and paste it to any USB flash drives that is connect to your computer simultaneously. This actually works pretty well. The only thing it doesn’t have is a progress bar. Is it possible to add to the code?

    I’ve found these 2 links below. That shows how to add a progress bar but I wasn’t able to get it to work with the existing code.

    I would like to use the” Windows Shell object” if possible.…/ee176633.aspx…ing-files.aspx

    sFolderToCopy = “C:Test”

    Set oFS = CreateObject(“Scripting.FileSystemObject”)
    Set dUSBKeys = ScanForUSBKeys()

    For Each oUSBKey in dUSBKeys.Keys
    If Left(oUSBKey, 1) = “” Then
    sKey = oUSBKey
    sKey = oUSBKey & “”
    End If

    oFS.CopyFolder sFolderToCopy, sKey


    Set dUSBKeys = Nothing
    Set oFS = Nothing

    Msgbox “Done.”

    Function ScanForUSBKeys()
    Set oWMI = GetObject(“winmgmts:\.rootcimv2”)
    Set dTemp = CreateObject(“Scripting.Dictionary”)

    Set cDisks = oWMI.ExecQuery(“Select InterfaceType,MediaType,PNPDeviceID,DeviceID,Size from Win32_DiskDrive”)
    For Each oDisk in cDisks
    If InStr(LCase(oDisk.InterfaceType),”usb”) > 0 AND InStr(LCase(oDisk.MediaType),”removable”) > 0 _
    AND InStr(LCase(oDisk.PNPDeviceID),”blackberry”) = 0 AND InStr(LCase(oDisk.PNPDeviceID),”ipod”) = 0 _
    AND NOT oDisk.PNPDeviceID = “” Then
    Set cDrivePartitions = oWMI.ExecQuery(“ASSOCIATORS OF {Win32_DiskDrive.DeviceID='” & _
    oDisk.DeviceID & “‘} WHERE AssocClass = Win32_DiskDriveToDiskPartition” )
    For Each oDrivePartition in cDrivePartitions
    Set cDriveLetters = oWMI.ExecQuery(“ASSOCIATORS OF {Win32_DiskPartition.DeviceID='” & _
    oDrivePartition.DeviceID & “‘} WHERE AssocClass = Win32_LogicalDiskToPartition”)
    For Each oDriveLetter in cDriveLetters
    dTemp.Add oDriveLetter.DeviceID, 1
    Set cDriveLetters = Nothing
    Set cDrivePartitions = Nothing
    End If
    Set cDisks = Nothing
    Set ScanForUSBKeys = dTemp
    Set dTemp = Nothing
    Set oWMI = Nothing
    End Function

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: