include application_*.evtx files
This commit is contained in:
@@ -7,6 +7,7 @@ If ( (IsWindowsVersion -ge "6.2") )
|
|||||||
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppXDeploymentServer_*.evtx" } | Remove-Item -Force
|
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppXDeploymentServer_*.evtx" } | Remove-Item -Force
|
||||||
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppxErrorReport_*.txt" } | Remove-Item -Force
|
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppxErrorReport_*.txt" } | Remove-Item -Force
|
||||||
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppXPackaging_*.evtx" } | Remove-Item -Force
|
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "AppXPackaging_*.evtx" } | Remove-Item -Force
|
||||||
|
Get-ChildItem -Path $SysTemp | Where { $_.Name -like "Application_*.evtx" } | Remove-Item -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
## Remove runaway CBS logs
|
## Remove runaway CBS logs
|
||||||
@@ -20,7 +21,7 @@ If ( Test-Path $CBSLogDir )
|
|||||||
## Remove all system temp files older than the specified number of days
|
## Remove all system temp files older than the specified number of days
|
||||||
$OlderThan=7
|
$OlderThan=7
|
||||||
$timedelta = New-TimeSpan -Days $OlderThan
|
$timedelta = New-TimeSpan -Days $OlderThan
|
||||||
Write-Output "Deleting all files older than ${OlderThan} day(s) from ${SysTemp}"
|
Write-Output "Deleting all files more than ${OlderThan} day(s) old ${SysTemp}"
|
||||||
Foreach ( $item in (Get-ChildItem -Path "${SysTemp}") )
|
Foreach ( $item in (Get-ChildItem -Path "${SysTemp}") )
|
||||||
{
|
{
|
||||||
## If it's older than the number of days specified, recursively delete the directory
|
## If it's older than the number of days specified, recursively delete the directory
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
## 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)
|
||||||
|
|
||||||
|
## Remove previous package
|
||||||
|
If ( Test-Path $FILE ) { Remove-Item -Path $FILE -Force | Out-Null}
|
||||||
|
|
||||||
|
## Download installer
|
||||||
|
Write-Output "Downloading: ${URL}"
|
||||||
|
Try { (New-Object System.Net.WebClient).DownloadFile($URL, $FILE) }
|
||||||
|
Catch { Write-Output $_.Exception.Message }
|
||||||
|
|
||||||
|
## Stop app if it's currently running
|
||||||
|
Get-Process | Where { $_.Name -like "nextcloud" } | Stop-Process -Force
|
||||||
|
|
||||||
|
## Get the install location so we can start the app again after installation
|
||||||
|
If ( Test-Path "HKLM:SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" )
|
||||||
|
{ $InstallPath = '{0}\nextcloud.exe' -f $(Get-ItemProperty -Path "HKLM:SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" -ErrorAction SilentlyContinue).InstallLocation }
|
||||||
|
ElseIf ( Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" )
|
||||||
|
{ $InstallPath = '{0}\nextcloud.exe' -f $(Get-ItemProperty -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Nextcloud" -ErrorAction SilentlyContinue).InstallLocation }
|
||||||
|
|
||||||
|
## Install package
|
||||||
|
If ( Test-Path $FILE )
|
||||||
|
{
|
||||||
|
Write-Output "Installing: ${FILE}"
|
||||||
|
Try { Start-Process -FilePath $FILE -ArgumentList "/S" -Wait }
|
||||||
|
Catch { $_.Exception.Message }
|
||||||
|
}
|
||||||
|
Else { Write-Output "${FILE} does not exist" }
|
||||||
|
|
||||||
|
## Start the app after installation
|
||||||
|
If ( Test-Path $InstallPath )
|
||||||
|
{
|
||||||
|
Write-Output "Starting Nextcloud"
|
||||||
|
Start-Process $InstallPath
|
||||||
|
}
|
||||||
|
|
||||||
|
## Delete installer package
|
||||||
|
If ( Test-Path $FILE )
|
||||||
|
{
|
||||||
|
Write-Output "Deleting ${FILE}"
|
||||||
|
Try { Remove-Item -Path $FILE -Force }
|
||||||
|
Catch { Write-Output $_.Exception.Message }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user