CMD powercfg.exe /HIBERNATE OFF --------------------------------------------------------------------------------------------------------- Search for 7-Zip installers (like 7z2500-x64.exe) in the root folder of all attached drives .ps1 foreach( $drive in [System.IO.DriveInfo]::GetDrives() ) { if( $found = Join-Path -Path $drive.RootDirectory -ChildPath '7z*-x64.exe' -Resolve -ErrorAction 'SilentlyContinue' ) { Start-Process -FilePath $found -ArgumentList '/S /D="C:\Program Files\7-Zip"' -Wait; return; } } 'Cannot find any files that match pattern.' | Write-Warning; --------------------------------------------------------------------------------------------------------- Download and install Microsoft Visual C++ Redistributable .ps1 $uri = [uri]::new( 'https://aka.ms/vs/17/release/vc_redist.x64.exe' ); $file = "$env:TEMP\{0}" -f $uri.Segments[-1]; [System.Net.WebClient]::new().DownloadFile( $uri, $file ); Start-Process -FilePath $file -ArgumentList '/quiet /norestart' -Wait; Remove-Item -LiteralPath $file -ErrorAction 'SilentlyContinue'; --------------------------------------------------------------------------------------------------------- Download and install Google Chrome .ps1 $uri = [uri]::new( 'https://dl.google.com/chrome/install/chrome_installer.exe' ); $file = "$env:TEMP\{0}" -f $uri.Segments[-1]; [System.Net.WebClient]::new().DownloadFile( $uri, $file ); Start-Process -FilePath $file -ArgumentList '/silent /install' -Wait; Remove-Item -LiteralPath $file -ErrorAction 'SilentlyContinue'; --------------------------------------------------------------------------------------------------------- Download the latest release of Windows Terminal from GitHub .ps1 $user = 'microsoft'; $repository = 'terminal'; $latest = $( Invoke-WebRequest -Uri "https://api.github.com/repos/${user}/${repository}/releases" -UseBasicParsing -Headers @{ Accept = 'application/vnd.github.v3+json'; } | Select-Object -ExpandProperty 'Content' | ConvertFrom-Json; ) | Where-Object -FilterScript { -not $_.draft -and -not $_.prerelease; } | Select-Object -First 1; $latest.assets.browser_download_url | Where-Object -FilterScript { $_ -match '\.msixbundle$'; } | Select-Object -First 1 | ForEach-Object -Process { $uri = [uri]::new( $_ ); $file = "$env:TEMP\{0}" -f $uri.Segments[-1]; [System.Net.WebClient]::new().DownloadFile( $uri, $file ); Add-AppxProvisionedPackage -Online -PackagePath $file -SkipLicense; Remove-Item -LiteralPath $file -ErrorAction 'SilentlyContinue'; }; --------------------------------------------------------------------------------------------------------- Allow inbound ICMP messages, including echo requests (ping), in Windows Firewall. .ps1 New-NetFirewallRule -DisplayName 'ICMPv4' -Profile 'Any' -Protocol 'ICMPv4' -Action 'Allow'; --------------------------------------------------------------------------------------------------------- Change profile of Ethernet network from Public to Private .ps1 Get-NetConnectionProfile -InterfaceAlias 'Ethernet*' | Set-NetConnectionProfile -NetworkCategory 'Private'; --------------------------------------------------------------------------------------------------------- Derive computer name from MAC address .ps1 $adapter = Get-NetAdapter -Name 'Ethernet*' -ErrorAction 'SilentlyContinue' | Select-Object -First 1; if( $adapter ) { return 'PC-' + ( $adapter.MacAddress -replace '-', '' ); } else { "Could not find Ethernet adapter." | Write-Warning; }