Skip to content

PowerShell#

What is PowerShell?

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

PowerShell commands let you manage computers from the command line. PowerShell providers let you access data stores, such as the registry and certificate store, as easily as you access the file system. PowerShell includes a rich expression parser and a fully developed scripting language.

Resources#

Scripts & Snippets#

Disable Beep#

Code#

PowerShell
1
2
3
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
if (!(Test-Path -Path "$Profile")) {New-Item -ItemType File -Path "$Profile" -Force}
Add-Content -Value "Set-PSReadlineOption -BellStyle None" -Path "$Profile"

What?#

This series of commands will:

  1. Set your execution policy so that you can have a $profile
  2. Create a profile located at C:\Users\<username>\Documents\WindowsPowerShell called Microsoft.PowerShell_profile.ps1
  3. The file contents will be Set-PSReadlineOption -BellStyle None

Note

If you already have a $profile, you'll want to simply add Set-PSReadlineOption -BellStyle None to it.

Disable Startup Message#

Code#

Add Clear-Host to your $profile. For more information on $profile, see the above section about disabling beep.

What?#

This removes that obnoxious startup message text:

Text Only
1
2
3
4
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

Windows 10 Pro → Enterprise#

Code#

Batchfile
cscript.exe c:\windows\system32\slmgr.vbs /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43

What?#

This command, which is technically a Windows Command and not PowerShell, will turn any Windows 10 Pro install into a Windows 10 Enterprise install. No reboot required!

Source: Windows 10 Edition Upgrade @ Microsoft Docs

Why?#

Sometimes you're working in an Enterprise environment and have a machine that just has to be reimaged with normal, Pro edition Windows on it. This command allows you to convert it to Enterprise afterwards, bind it to your domain, and make sure you're getting the proper licensing.