diff --git a/Fix-WindowsHealth.ps1 b/Fix-WindowsHealth.ps1 index 0e9e44a..7ac9f44 100644 --- a/Fix-WindowsHealth.ps1 +++ b/Fix-WindowsHealth.ps1 @@ -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 } \ No newline at end of file +Else { Log "Online image cleanup and restoration is only supported on Windows 8 and higher" $LogName } \ No newline at end of file diff --git a/Install-Nextcloud.ps1 b/Install-Nextcloud.ps1 index 17c5a99..0eacb1c 100644 --- a/Install-Nextcloud.ps1 +++ b/Install-Nextcloud.ps1 @@ -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} diff --git a/Tools.ps1 b/Tools.ps1 index 2e4fccd..2d6e425 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -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" diff --git a/resources/Nextcloud-3.0.1-setup.exe b/resources/Nextcloud-3.0.1-setup.exe new file mode 100644 index 0000000..1f26da8 Binary files /dev/null and b/resources/Nextcloud-3.0.1-setup.exe differ