Windows – Rename Computer

PowerShell $(gwmi win32_computersystem).Rename(“PC-NewName”) Rename-Computer -NewName PC-NewName -Restart Invoke-command -computer PC-OldName -script {rename-computer PC-NewName; restart-computer} Commands WMIC ComputerSystem where Name=”PC-NewName” call Rename Name=NewName netdom renamecomputer %computername% /newname:PC-NewName /userd:domain\adminaccount /passwordd:password /reboot:10   Notes Rename-Computer Invoke-Command Netdom.exe WMIC.exe Get-WmiObject (gwmi)

PowerShell – Create and Import Self-Signed Certificate

  Code.cpp   # MrNetTek # eddiejackson.net # 5/22/2021 # free for public use # free to claim as your own Clear-Host Start-Transcript -Path ‘C:\PowerShell\lab\certificate\log.txt’ Import-Module PKI -WarningAction SilentlyContinue #Sign Cert Info $Certificate = @{ Subject = ‘CodeSign.com’ Type = “CodeSign” CertStoreLocation = “Cert:\CurrentUser\My” } #Generate Signed Certificate $SignedCertificate = New-SelfSignedCertificate @Certificate #Show Signed Cert Read More …

PowerShell – Add ISE Support for PowerShell 7

This is how you add an option to switch to PS7 (and back to PS5) to the ISE Menu. #1 Open PowerShell ISE #2 Run: $PSVersionTable Check PS Version #3 Copy/Paste/Run   Code.cpp   # MrNetTek # eddiejackson.net # 5/22/2021 # free for public use $ErrorActionPreference= ‘silentlycontinue’ $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear() $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(“Switch to PowerShell 7”, { function New-OutOfProcRunspace Read More …

Windows 10 – Freeze a Windows Build Version

This is how you lock the Windows build version—meaning this will prevent a future release from being automatically applied. Useful for gaining control over the build versions in your fleet. Enable reg add “HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate” /v TargetReleaseVersion /t REG_DWORD /d 1 /f /reg:64 Set Version reg add “HKLM\SOFTWARE\Policies\M9icrosoft\Windows\WindowsUpdate” /v TargetReleaseVersionInfo /t REG_SZ /d 2004 /f /reg:64 Read More …

PowerShell – Create Zip and Backup File

  Code.cpp   # MrNetTek # eddiejackson.net # 5/16/2021 # free for public use # free to claim as your own # Load assembly Add-Type -assembly “system.io.compression.filesystem” # Variables $zipSource = “C:\PowerShell\Files” $zipPath = “C:\PowerShell” $zipName = “files.zip” $zipDestination = “C:\PowerShell\Backup” # Join archive path $ArchiveFile = Join-Path -Path $zipPath -ChildPath $zipName # Compress files Read More …