@@ -88,26 +88,28 @@ Attempts to update packages, features, and system.
88
88
Justification= ' This script is not intended for pipelining.' )]
89
89
[CmdletBinding ()] Param (
90
90
# The sources of updates to install, in order.
91
- [ValidateSet (' Chocolatey' , ' DellCommand' , ' Dotnet' , ' Essential' , ' GitHubCli' , ' Npm' ,
91
+ [ValidateSet (' Chocolatey' , ' DellCommand' , ' Dotnet' , ' Essential' , ' GitHubCli' , ' Npm' , ' ScriptsData ' ,
92
92
' PSHelp' , ' PSModule' , ' Scoop' , ' WindowsUpdate' , ' WindowsStore' , ' WinGet' )]
93
93
[Parameter (Position = 0 , ValueFromRemainingArguments = $true )][string []] $Steps =
94
94
@ (' Essential' , ' WindowsStore' , ' Scoop' , ' Chocolatey' , ' WinGet' , ' Npm' , ' Dotnet' ,
95
- ' GitHubCli' , ' PSModule' , ' PSHelp' , ' DellCommand' , ' WindowsUpdate' )
95
+ ' GitHubCli' , ' ScriptsData ' , ' PSModule' , ' PSHelp' , ' DellCommand' , ' WindowsUpdate' )
96
96
)
97
97
Begin
98
98
{
99
+ Import-CharConstants.ps1 ' :UP:' - Scope Script
100
+
99
101
function Test-EmptyDesktop ([switch ] $Shared )
100
102
{
101
103
if ($Shared -and ! (Test-Administrator.ps1 )) {return $false }
102
104
$dir = [environment ]::GetFolderPath(($Shared ? ' CommonDesktopDirectory' : ' Desktop' ))
103
- return ! (Get-ChildItem - Path $dir - Filter * .lnk)
105
+ return ! (Join- Path $dir * .lnk | Get-Item )
104
106
}
105
107
106
108
function Clear-Desktop ([switch ] $Shared )
107
109
{
108
110
if ($Shared -and ! (Test-Administrator.ps1 )) {return }
109
111
$dir = [environment ]::GetFolderPath(($Shared ? ' CommonDesktopDirectory' : ' Desktop' ))
110
- Remove-Item - Path $dir - Filter * .lnk
112
+ Remove-Item ( Join -Path $dir * .lnk)
111
113
}
112
114
113
115
Set-Variable ' UP!' " $ ( [char ]0xD83C ) $ ( [char ]0xDD99 ) " - Option Constant - Scope Script - Description ' UP! symbol'
@@ -119,7 +121,7 @@ Begin
119
121
120
122
function Invoke-EssentialUpdate
121
123
{
122
- Write-Step " ${UP!} Updating PowerShell & Windows Terminal"
124
+ Write-Step " $UP Updating PowerShell & Windows Terminal"
123
125
Get-Process powershell - ErrorAction Ignore | Where-Object Id -ne $PID | Stop-Process - Force
124
126
Get-Process pwsh - ErrorAction Ignore | Where-Object Id -ne $PID | Stop-Process - Force
125
127
Start-Process ([io.path ]::ChangeExtension($PSCommandPath , ' cmd' )) - Verb RunAs - WindowStyle Maximized
@@ -159,7 +161,7 @@ Begin
159
161
if (! (Test-Administrator.ps1 )) {Write-Warning " Not running as admin; skipping WindowsStore." ; return }
160
162
if (! (Get-Command Get-CimInstance - ErrorAction Ignore))
161
163
{Write-Verbose ' Get-CimInstance not found, skipping WindowsStore updates' ; return }
162
- Write-Step " ${UP!} Updating Windows Store apps (asynchronously)"
164
+ Write-Step " $UP Updating Windows Store apps (asynchronously)"
163
165
Get-CimInstance MDM_EnterpriseModernAppManagement_AppManagement01 - Namespace root\cimv2\mdm\dmmap |
164
166
Invoke-CimMethod - MethodName UpdateScanMethod
165
167
}
@@ -168,7 +170,7 @@ Begin
168
170
{
169
171
if (! (Get-Command scoop - ErrorAction Ignore))
170
172
{Write-Verbose ' Scoop not found, skipping' ; return }
171
- Write-Step " ${UP!} Updating Scoop packages"
173
+ Write-Step " $UP Updating Scoop packages"
172
174
scoop update *
173
175
}
174
176
@@ -177,31 +179,31 @@ Begin
177
179
if (! (Test-Administrator.ps1 )) {Write-Warning " Not running as admin; skipping Chocolatey." ; return }
178
180
if (! (Get-Command choco - ErrorAction Ignore))
179
181
{Write-Verbose ' Chocolatey not found, skipping' ; return }
180
- Write-Step " ${UP!} Updating Chocolatey packages"
182
+ Write-Step " $UP Updating Chocolatey packages"
181
183
choco upgrade all - y
182
184
}
183
185
184
186
function Update-WinGet
185
187
{
186
188
if (! (Get-Command winget - ErrorAction Ignore))
187
189
{Write-Verbose ' WinGet not found, skipping' ; return }
188
- Write-Step " ${UP!} Updating WinGet packages"
190
+ Write-Step " $UP Updating WinGet packages"
189
191
winget upgrade -- all
190
192
}
191
193
192
194
function Update-Npm
193
195
{
194
196
if (! (Get-Command npm - ErrorAction Ignore))
195
197
{Write-Verbose ' Npm not found, skipping' ; return }
196
- Write-Step " ${UP!} Updating npm packages"
198
+ Write-Step " $UP Updating npm packages"
197
199
npm update - g
198
200
}
199
201
200
202
function Update-Dotnet
201
203
{
202
204
if (! (Get-Command dotnet - ErrorAction Ignore))
203
205
{Write-Verbose ' Dotnet not found, skipping' ; return }
204
- Write-Step " ${UP!} Updating dotnet global tools"
206
+ Write-Step " $UP Updating dotnet global tools"
205
207
& " $PSScriptRoot \Get-DotNetGlobalTools.ps1" |
206
208
Where-Object {
207
209
$_.Version -lt (& " $PSScriptRoot \Find-DotNetGlobalTools.ps1" $_.PackageName |
@@ -214,13 +216,13 @@ Begin
214
216
{
215
217
if (! (Get-Command gh - ErrorAction Ignore))
216
218
{Write-Verbose ' gh not found, skipping' ; return }
217
- Write-Step " ${UP!} Updating GitHub CLI extensions"
219
+ Write-Step " $UP Updating GitHub CLI extensions"
218
220
gh extension upgrade -- all
219
221
}
220
222
221
223
function Update-PSModule
222
224
{
223
- Write-Step " ${UP!} Updating PowerShell modules"
225
+ Write-Step " $UP Updating PowerShell modules"
224
226
Get-Module - ListAvailable |
225
227
Group-Object Name |
226
228
Where-Object {
@@ -231,23 +233,30 @@ Begin
231
233
Update-Module - Force
232
234
if (Get-Command Uninstall-OldModules.ps1 - ErrorAction Ignore)
233
235
{
234
- Write-Step " ${UP!} Uninstalling old PowerShell modules"
236
+ Write-Step " $UP Uninstalling old PowerShell modules"
235
237
Uninstall-OldModules.ps1 - Force
236
238
}
237
239
}
238
240
239
241
function Update-PSHelp
240
242
{
241
- Write-Step " ${UP!} Updating PowerShell help"
243
+ Write-Step " $UP Updating PowerShell help"
242
244
Update-Help
243
245
}
244
246
247
+ function Update-ScriptsData
248
+ {
249
+ Write-Step " $UP Updating scripts data"
250
+ Get-UnicodeName.ps1 - Update
251
+ Get-UnicodeByName.ps1 - Update
252
+ }
253
+
245
254
function Update-DellCommand
246
255
{
247
256
if (! (Test-Administrator.ps1 )) {Write-Warning " Not running as admin; skipping DellCommand." ; return }
248
257
if (! (Resolve-Path " C:\Program Files*\Dell\CommandUpdate\dcu-cli.exe" ))
249
258
{Write-Verbose ' Dell Command not found, skipping' ; return }
250
- Write-Step " ${UP!} Updating Dell firmware & system software"
259
+ Write-Step " $UP Updating Dell firmware & system software"
251
260
Set-Alias dcu- cli " $ ( Resolve-Path " C:\Program Files*\Dell\CommandUpdate\dcu-cli.exe" ) "
252
261
dcu- cli / scan
253
262
if ($LASTEXITCODE -ne 500 ) {dcu- cli / applyUpdates - reboot= enable}
@@ -259,7 +268,7 @@ Begin
259
268
if (! (Test-Administrator.ps1 )) {Write-Warning " Not running as admin; skipping Windows." ; return }
260
269
if (! (Get-Module PSWindowsUpdate - ListAvailable))
261
270
{Write-Verbose ' PSWindowsUpdate module not found, skipping Windows Updates' ; return }
262
- Write-Step " ${UP!} Updating Windows"
271
+ Write-Step " $UP Updating Windows"
263
272
Get-WindowsUpdate
264
273
Install-WindowsUpdate | Format-Table X, Result, KB, Size, Title
265
274
}
0 commit comments