Framework/Configurations/AutoUpdate/ModuleAutoUpdate.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
try
{
    Write-Host "Starting the auto-update process..." -ForegroundColor Cyan
    Get-Process | Where-Object { ($_.Name -eq 'powershell' -or $_.Name -eq 'powershell_ise' -or $_.Name -eq 'powershelltoolsprocesshost') -and $_.Id -ne $PID} | Stop-Process 
    ##installurl##
    Write-Host "Completed the auto-update process successfully!" -ForegroundColor Green
}
catch
{
    Write-Host "There was an error during the auto-update process. Please update manually by running '##installurl##' " -ForegroundColor Red
    Write-Host "DetailedError:`n $_"
}
finally
{
    $option = Read-Host "Press [Enter] to close this session..."
}
#exit