Nuovo Script - Check W32Time Difference
This commit is contained in:
@@ -31,7 +31,7 @@ $giteaDestination = "gitea.steamware.net"
|
||||
#nome utente gitea che effettua i mirror push
|
||||
$giteaUser = "replica"
|
||||
#autenticazione replica gitea
|
||||
$giteaPass = "ajejebrazorf92!"
|
||||
$giteaPass = "viadante16"
|
||||
#access token per autenticazione gitea da profilo replica
|
||||
$giteaHead = @{"Authorization" = "token 3619817f299bb3d92c8a8f86d5fddbe877b60ffa" }
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ $startTime = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
|
||||
# avvio stopwatch
|
||||
$mainStopWatch = [system.diagnostics.stopwatch]::StartNew()
|
||||
#contatore ciclo do while
|
||||
$projectCount = 1
|
||||
$projectCount = 200
|
||||
#numero massimo di progetti da analizzare
|
||||
$projectNumber = 300
|
||||
#conteggio progetti trovati
|
||||
@@ -26,10 +26,10 @@ $deleteProtection = 1
|
||||
$logFile = "GitlabProtectedBranches.log"
|
||||
|
||||
#specifica quale installazione di gitlab va controllata
|
||||
#$gitlabIstance = $destinationNembro
|
||||
#$head = $nembroHead
|
||||
$gitlabIstance = $destinationAzzano
|
||||
$head = $azzanoHead
|
||||
$gitlabIstance = $destinationNembro
|
||||
$head = $nembroHead
|
||||
#$gitlabIstance = $destinationAzzano
|
||||
#$head = $azzanoHead
|
||||
|
||||
#creazione folder di Log se non già esistente
|
||||
if (Test-Path $logFolder) {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
####SCRIPT PER CONTROLLARE TIME DRIFT WINDOWS####
|
||||
|
||||
#rilevo data e ora
|
||||
$currentTime = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
|
||||
#nome file di log
|
||||
$logFile = "W32TimeDriftCheck.log"
|
||||
#cartella file di log
|
||||
$logFolder = "c:\Steamware\Logs\"
|
||||
#opzione log su file: scrivo se = 1, ignoro se = 0
|
||||
$logType = 1
|
||||
#opzione output in terminale: scrivo se = 1, ignoro se = 0
|
||||
$terminalOutput = 1
|
||||
#Ipv4 PDC
|
||||
$PDC = "10.74.82.251"
|
||||
#Ipv4 BDC
|
||||
$BDC = "10.74.82.250"
|
||||
|
||||
#creazione folder di Log se non già esistente
|
||||
if (Test-Path $logFolder) {
|
||||
}
|
||||
else {
|
||||
New-Item $logFolder -ItemType Directory
|
||||
}
|
||||
|
||||
#funzione locale per log su file e output su terminale
|
||||
Function WriteLogOutput {
|
||||
Param ([string]$logString)
|
||||
#compongo path per file di log
|
||||
$logPath = Join-Path $logFolder $logFile
|
||||
#scrivo su file la stringa se $logType=1
|
||||
if ($logType -eq 1) {
|
||||
Add-content $logPath -value "$logString"
|
||||
}
|
||||
#scrivo su terminale la stringa se $terminalOutput=1
|
||||
if ($terminalOutput -eq 1) {
|
||||
Write-Output($logString)
|
||||
}
|
||||
}
|
||||
|
||||
#calcolo differenza PDC, restituisco in secondi
|
||||
$timeDifferencePDC = (& w32tm /stripchart /computer:$PDC /samples:1 /dataonly)[-1].Trim("s") -split ',\s*'
|
||||
#calcolo differenza BDC, restituisco in secondi
|
||||
$timeDifferenceBDC = (& w32tm /stripchart /computer:$BDC /samples:1 /dataonly)[-1].Trim("s") -split ',\s*'
|
||||
|
||||
#scrivo log data e ora
|
||||
WriteLogOutput "Script Execution: $currentTime"
|
||||
#output differenza PDC
|
||||
WriteLogOutput "Time Difference W2022PDC: $timeDifferencePDC s"
|
||||
#output differenza BDC
|
||||
WriteLogOutput "Time Difference W2022BDC: $timeDifferenceBDC s"
|
||||
WriteLogOutput "---"
|
||||
Reference in New Issue
Block a user