BryanErskine
IS-IT--Management
Ok Here is the problem, Our network the students log into google chrome and even when they log out the next user that logs in gets that students google chrome settings etc. In order to fix this I found a folder that can be deleted in order to fix this I want to have this script run at log off through the group policy however I am having an issue with the Script.
When I use this script I get a permissions Error at Line 10
Is there way to make this run as an administrator? The file is a hidden file.
I want the C:\Users\*\AppData\Local\Google\Chrome\User Data File deleted
I've tested just going in through windows explorer and deleting this file when I log off and on as another user the chrome data is all gone so this works, the script however ..... does not
I'm sure this is a very crude way of doing this however I am still new to scripting. Any help would be much appreciated.
Dim FSfolder
Dim subfolder
Dim i
set objshell = CreateObject("Wscript.shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Profile = strSysDrive & "C:\Documents and Settings"
Set FSfolder = FSO.GetFolder(Profile) 'getting the user profile folders
For Each subfolder In FSfolder.SubFolders
If (subfolder.Name <> "All Users" And subfolder.Name <> "Default User"_
and subfolder.Name <> "LocalService" and subfolder.Name <> "NetworkService") Then
folder1=Profile & "\" & subfolder.Name & "\Appdata\Local\Google\Chrome\User Data"
DeleteThisFolder(folder1)
end if
Next
'*******************************************************************************************************
Function DeleteThisFolder(FolderName)
If FSO.FolderExists(FolderName) Then
objshell.Run "CMD.EXE /C RD /S /Q """ & FolderName & """",0,True
End If
End Function
Please help and thank you for any help you can give.
Bryan
When I use this script I get a permissions Error at Line 10
Is there way to make this run as an administrator? The file is a hidden file.
I want the C:\Users\*\AppData\Local\Google\Chrome\User Data File deleted
I've tested just going in through windows explorer and deleting this file when I log off and on as another user the chrome data is all gone so this works, the script however ..... does not
I'm sure this is a very crude way of doing this however I am still new to scripting. Any help would be much appreciated.
Dim FSfolder
Dim subfolder
Dim i
set objshell = CreateObject("Wscript.shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Profile = strSysDrive & "C:\Documents and Settings"
Set FSfolder = FSO.GetFolder(Profile) 'getting the user profile folders
For Each subfolder In FSfolder.SubFolders
If (subfolder.Name <> "All Users" And subfolder.Name <> "Default User"_
and subfolder.Name <> "LocalService" and subfolder.Name <> "NetworkService") Then
folder1=Profile & "\" & subfolder.Name & "\Appdata\Local\Google\Chrome\User Data"
DeleteThisFolder(folder1)
end if
Next
'*******************************************************************************************************
Function DeleteThisFolder(FolderName)
If FSO.FolderExists(FolderName) Then
objshell.Run "CMD.EXE /C RD /S /Q """ & FolderName & """",0,True
End If
End Function
Please help and thank you for any help you can give.
Bryan