#By tausif for FICO ############### if ((Get-Service Code42Service).Status -eq "Running") { #get code42 logged in user if (Test-Path "$env:ALLUSERSPROFILE\CrashPlan\.identity") { $c42currentuser = (Get-Content $env:ALLUSERSPROFILE\CrashPlan\.identity) | Select-String -Pattern "username" #Get last backup date ################################################################################## $todaysdate = Get-Date -UFormat "%m/%d/%y" $dt = [DateTIme]$todaysdate $todayminus60 = $dt.AddDays(-60) $logdatepattern = "\d{2}/\d{2}/\d{2}" if (Test-Path "$env:ALLUSERSPROFILE\CrashPLan\Log\history.log.0") { $lastlinedateonhistorylog = (Get-Content $env:ALLUSERSPROFILE\CrashPLan\Log\history.log.0)[-1] | Select-String -Pattern $logdatepattern | foreach {$_.Matches.Groups[0].Value} $patcompletedbackuptoprecloud = "Completed backup to PROe Cloud" $backupcompleteline = (Get-Content $env:ALLUSERSPROFILE\CrashPlan\Log\history.log.0 | Select-String -Pattern $patcompletedbackuptoprecloud )[-1] $backuppaths = (Get-Content $env:ALLUSERSPROFILE\CrashPLan\Log\app.log)| Select-String -pattern "backupPaths " $lastbackupdate = [string]$backupcompleteline | Select-String -Pattern $logdatepattern | foreach {$_.Matches.Groups[0].Value} $ndt = [DateTIme]$lastbackupdate $dayssincelastbackup = (New-TimeSpan -Start $ndt -End $dt).TotalDays ###### If ($dayssincelastbackup -ge "30") { Write-Output "More than $dayssincelastbackup since last backup, Last back up date: $lastbackupdate, C42 logged on $c42currentuser, $backuppaths" exit 1 } else { Write-Output "Days since last backup $dayssincelastbackup, Last back up date: $lastbackupdate, C42 logged on $c42currentuser, $backuppaths" exit 0 } } else { Write-Output "No history of successful backup" exit 1 } } else { Write-Output "No User logged in" exit 1 } } else { Write-Output "Code42 Service not running" exit 1 }
Friday, 1 October 2021
Code42 proactive remediation - Check for last successful backup
There is no easy way to script a check on code42 being active and working on windows PCs. One way is to use the logs to read if Code42 is backing up recently.
Subscribe to:
Post Comments (Atom)
Detect autopilot session
Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...
-
Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...
-
Someone got this issue while trying to run a scottrade.com applet. To fix this 1: open java webstart by typing javaws -viewer,in a c...
-
So i was recently tasked with removing wireless restrictions from a VP's windows 7 laptop that some infrastructure company had plac...
No comments:
Post a Comment