Kaseya Community

Deleting Flash Cookies

  • I was wondering if anyone has a script or vbs or something to delete the flash cookies (locations below).

    When time allows, I'm going to start on a vbs to do so but was wondering if anyone had beat me to it.

    C:\Documents and Settings\{UserName}\Application Data\Macromedia\Flash Player\#SharedObjects


    C:\Documents and Settings\{YourUserName}\Application Data\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\


    I know you can set the CCLEANER.INI to do this, but it will only do it for a specific user. (I don't think it takes wild cards).

    Just thought I'd throw it out there before I get started...

    Legacy Forum Name: Deleting Flash Cookies,
    Legacy Posted By Username: thirteentwenty
  • Guess not lol...

    Anyways, heres a vbs for Vista/(7)

    I've tested in Vista but not in 7 yet... but the locations are the same so it should work. I'll be working on an XP script and try to get that up shortly...


    Usage: run on any Vista/7 Machine, It will go through and delete the Flash Temp files for all users. YMMV UAYOR

    Test before deploying

    strComputer = "."
    strFlashDir1 = "\AppData\Roaming\Macromedia\Flash Player\#SharedObjects"
    strFlashDir2 = "\AppData\Roaming\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys"

    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objFSO_1 = CreateObject("Scripting.FileSystemObject")
    Set objFSO_2 = CreateObject("Scripting.FileSystemObject")

    ' get all user folders
    Set colSubfolders = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='c:\users'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFolder in colSubfolders
    'wScript.Echo objFolder.Name
    'verify that strFlashDir1 exists
    If objFSO_1.FolderExists(objFolder.Name & strFlashDir1) Then
    'wScript.Echo objFolder.Name & strFlashDir1 & vbcrlf & vbcrlf & "Folder exists"
    Set colSubfolders_1 = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='" & objFolder.Name & strFlashDir1 & "'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFlashTempFolder in colSubfolders_1
    ' wScript.Echo objFlashTempFolder.Name
    objFSO_1.deletefolder objFlashTempFolder.Name
    Next
    End If

    'verify taht strFlashDir2 exists
    If objFSO_2.FolderExists(objFolder.Name & strFlashDir2) Then
    'wScript.Echo objFolder.Name & strFlashDir2 & vbcrlf & vbcrlf & "Folder exists"
    Set colSubfolders_2 = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='" & objFolder.Name & strFlashDir2 & "'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFlashTempFolder in colSubfolders_2
    ' wScript.Echo objFlashTempFolder.Name
    objFSO_2.deletefolder objFlashTempFolder.Name
    Next
    End If

    Next


    XP vbs


    strComputer = "."
    strFlashDir1 = "\Application Data\Macromedia\Flash Player\#SharedObjects"
    strFlashDir2 = "\Application Data\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys"

    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objFSO_1 = CreateObject("Scripting.FileSystemObject")
    Set objFSO_2 = CreateObject("Scripting.FileSystemObject")

    ' get all user folders
    Set colSubfolders = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='c:\Documents and Settings'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFolder in colSubfolders
    'wScript.Echo objFolder.Name
    'verify that strFlashDir1 exists
    If objFSO_1.FolderExists(objFolder.Name & strFlashDir1) Then
    'wScript.Echo objFolder.Name & strFlashDir1 & vbcrlf & vbcrlf & "Folder exists"
    Set colSubfolders_1 = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='" & objFolder.Name & strFlashDir1 & "'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFlashTempFolder in colSubfolders_1
    ' wScript.Echo objFlashTempFolder.Name
    objFSO_1.deletefolder objFlashTempFolder.Name
    Next
    End If

    'verify taht strFlashDir2 exists
    If objFSO_2.FolderExists(objFolder.Name & strFlashDir2) Then
    'wScript.Echo objFolder.Name & strFlashDir1 & vbcrlf & vbcrlf & "Folder exists"
    Set colSubfolders_2 = objWMIService.ExecQuery ("Associators of {Win32_Directory.Name='" & objFolder.Name & strFlashDir2 & "'} " & "Where AssocClass = Win32_Subdirectory " & "ResultRole = PartComponent")
    For Each objFlashTempFolder in colSubfolders_2
    ' wScript.Echo objFlashTempFolder.Name
    objFSO_2.deletefolder objFlashTempFolder.Name
    Next
    End If
    Next


    As always you're welcome to mod the code, but if you do please post it back here so we (more specifically I) can see the tweaks and how you've made it better...

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty