This commit is contained in:
2022-10-29 19:37:21 +02:00
parent 39aa565504
commit bb07bc3512
2 changed files with 80 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
' CopyGoogleChromeBookmarks.vbs - Copy Bookmarks File of Google Chrome to HomeDir
' and retain the last 14 Files (by Creation Date)
' v1.0 - 29.10.2022 - Initial Release
' WSHShell
Dim objWSH
Set objWSH = CreateObject("WScript.Shell")
' Define Variables
strProfileFolder = objWSH.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Google\Chrome\User Data\Default\"
strBackupBaseFolder = "H:\Backup\"
strBackupFolder = "H:\Backup\Chrome\"
strBackupFile = "BOOKMARKS"
intMaxFiles = 14
' File System Object
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Define actual Backup Folder
strActualBackupFile = strBackupFile & "_" & fncDateTimeString(now())
' Check, whether Backup Base Folder exists
If Not objFSO.FolderExists(strBackupBaseFolder) Then
objFSO.CreateFolder strBackupBaseFolder
End If
' Check, whether Backup Folder exists
If Not objFSO.FolderExists(strBackupFolder) Then
objFSO.CreateFolder strBackupFolder
End If
' Copy File
objFSO.CopyFile strProfileFolder & strBackupFile, strBackupFolder & strActualBackupFile
' Only run if we actually have more than 14 files...
Dim objFolder
Set objFolder = objFSO.GetFolder(strBackupFolder)
If objFolder.Files.Count > intMaxFiles Then
' Create an array to the hold the dates of each file in this folder...
ReDim aryFiles(objFolder.Files.Count - 1)
' Read all Files into an Array
i = 0
For Each oFile In objFolder.Files
aryFiles(i) = oFile.DateCreated
i = i + 1
Next
' Get the 14th most-recent date...
dtmCutOff = aryFiles(i-intMaxFiles)
' Iterate the files once more and delete any files older than our cut-off...
For Each oFile In objFolder.Files
If oFile.DateCreated < dtmCutOff Then oFile.Delete
Next
End If ' objFolder.Files.Count > intMaxFiles
Function fncDateTimeString(datDate)
' Format the Date as yyyymmdd
fncDateTimeString = Year(datDate)& right("0" & Month(datDate),2) & right("0" & Day(datDate),2) & right("0" & Hour(datDate),2) & right("0" & Minute(datDate),2) & right("0" & Second(datDate),2)
End Function

View File

@@ -0,0 +1,15 @@
@echo off
rem : Delete Machine Cert - Remove Certificate Named like the Computer
rem : Must be run as "Local System" by Software Management
rem : © 2022 Pohle ICT AG
rem : v1 - 23.07.2022 - Initial Release
rem : Outfit
Color 17
Title Delete Machine Cert
rem : Delete the Cert
certutil -delstore MY %COMPUTERNAME%.zentrale.schwesternschaft-muenchen.de
:END