change logging method, update nextcloud installer and url
This commit is contained in:
+13
-10
@@ -1,26 +1,29 @@
|
||||
## Run enhanced DISM for Windows 8 and higher endpoints
|
||||
If ( IsWindowsVersion -ge "6.2" )
|
||||
{
|
||||
## The name of the log file for this script
|
||||
$LogName = "Fix-WindowsHealth"
|
||||
|
||||
$BeginDISMRun = $(Get-Date).AddSeconds(-1)
|
||||
|
||||
## Scan the Windows Component Store for problems
|
||||
Log "Beginning Windows Component Store scan" $LogFile
|
||||
Log "Beginning Windows Component Store scan" $LogName
|
||||
Start-Process "dism.exe" -ArgumentList "/online /cleanup-image /scanhealth" -Wait
|
||||
Log "Completed Windows Component Store scan" $LogFile
|
||||
Log "Completed Windows Component Store scan" $LogName
|
||||
|
||||
## Check to see if the previous command recorded any problems that need repairing
|
||||
Log "Beginning Windows Component Store health check" $LogFile
|
||||
Log "Beginning Windows Component Store health check" $LogName
|
||||
$CheckHealthOutput = $(dism /online /cleanup-image /checkhealth) | Out-String
|
||||
If ( $CheckHealthOutput -match "repairable" )
|
||||
{
|
||||
Log "Completed Windows Component Store health check: Problems found" $LogFile
|
||||
Log "Completed Windows Component Store health check: Problems found" $LogName
|
||||
|
||||
## Repair problems with the Windows Component Store
|
||||
Log "Beginning Windows Component Store restoration" $LogFile
|
||||
Log "Beginning Windows Component Store restoration" $LogName
|
||||
Start-Process "dism.exe" -ArgumentList "/online /cleanup-image /restorehealth" -Wait
|
||||
Log "Completed Windows Component Store restoration" $LogFile
|
||||
Log "Completed Windows Component Store restoration" $LogName
|
||||
}
|
||||
Else { Log "Completed Windows Component Store health check: No problems found" $LogFile }
|
||||
Else { Log "Completed Windows Component Store health check: No problems found" $LogName }
|
||||
|
||||
$EndDISMRun = $(Get-Date).AddSeconds(1)
|
||||
|
||||
@@ -28,12 +31,12 @@ If ( IsWindowsVersion -ge "6.2" )
|
||||
$DISMLogFile = "${MSPLogs}\Fix-WindowsHealth_DISM.log"
|
||||
If ( Test-Path $DISMLogFile ) { Remove-Item $DISMLogFile -Force }
|
||||
New-Item -Path $DISMLogFile -ItemType File
|
||||
Log "Beginning Windows Component Store log data collection" $LogFile
|
||||
Log "Beginning Windows Component Store log data collection" $LogName
|
||||
Get-Content -Path "${Env:WinDir}\Logs\DISM\dism.log" | Select-String -Pattern '^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})' |
|
||||
% { If ( ((Get-Date $_.Line.Substring(0,19)) -gt $BeginDISMRun) -and ((Get-Date $_.Line.Substring(0,19)) -le $EndDISMRun) ) {
|
||||
Add-Content -Path $DISMLogFile -Value $_.Line
|
||||
}
|
||||
}
|
||||
Log "Completed Windows Component Store log data collection" $LogFile
|
||||
Log "Completed Windows Component Store log data collection" $LogName
|
||||
}
|
||||
Else { Log "Online image cleanup and restoration is only supported on Windows 8 and higher" $LogFile }
|
||||
Else { Log "Online image cleanup and restoration is only supported on Windows 8 and higher" $LogName }
|
||||
@@ -1,6 +1,6 @@
|
||||
## Define URL for downloading the installer
|
||||
$URL = 'https://download.nextcloud.com/desktop/releases/Windows/Nextcloud-3.0.1-setup.exe'
|
||||
$FILE = '{0}\{1}.exe' -f $Env:TEMP,(Split-Path $URL -Leaf)
|
||||
$URL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/Nextcloud-3.0.1-setup.exe'
|
||||
$FILE = Split-Path $URL -Leaf
|
||||
|
||||
## Remove previous package
|
||||
If ( Test-Path $FILE ) { Remove-Item -Path $FILE -Force | Out-Null}
|
||||
|
||||
@@ -25,7 +25,7 @@ If ( !(Test-Path $MSPLogs) )
|
||||
Function Log
|
||||
{
|
||||
param([string]$Message,[string]$LogName)
|
||||
$LogEntry = "{0} - {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"),$Message
|
||||
$LogEntry = "{0} - {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message
|
||||
If ($LogName )
|
||||
{
|
||||
$LogFile = "${MSPLogs}\${LogFilePrefix}-${LogName}.log"
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user