TR EB Ps CMD
TR EB Ps CMD
INTRODUCTION
When Microsoft developed PowerShell (PS) in November 2006, the aim was to marry a command-line
based interface and a scripting language to handle task automation and configuration management of native
Microsoft applications. Through the years it has seen upgrades that increase its functionality, with more cmdlets
(PS commands) and more support through importing modules to grant the framework greater flexibility in
managing a variety of services.
As PowerShell’s popularity has increased, its adoption rate has fueled further changes. Arguably the largest and
most recent of these was Microsoft’s decision to make PS open source, porting it to various Linux distributions
and macOS and enabling cross-platform support through one unified shell. What does this mean for
non-PowerShell users? Simply put, PS is poised to not only replace the venerable command line that Windows
admins know—but as organizations grow their user base with Linux and macOS-based devices, admins can
port that knowledge over to managing those devices as well, all from one console or shell.
For those who support Windows-only organizations, Microsoft has made inroads into PS-based management
by ensuring that much of its higher-level software, such as Windows Server, Active Directory, and Exchange,
will be 100% manageable only through PowerShell. Users managing services through the GUI or admin
consoles won’t be able to fully configure every aspect of the application unless they switch to PowerShell.
So here are some commonly used commands you may find are part of your daily admin tasks—and the PS
equivalent—to help you migrate your usage over to PowerShell.
THE CMDLETS
1. Changing directories
CMD: cd
PS: Set-Location “path/to/directory”
3. Renaming files
CMD: rename
PS: Rename-Item “path/to/file.ext” -NewName “newfilename.ext”
2
COPYRIGHT ©2018 CBS INTERACTIVE INC. ALL RIGHTS RESERVED.
20 POWERSHELL CMDLETS YOU CAN USE INSTEAD OF CMD COMMANDS
5. Stopping processes
CMD: taskkill
PS: Stop-Process -Name “application.exe”
9. Setting variables
CMD: SET variable=”value”
PS: $”variablename” = “value”
3
COPYRIGHT ©2018 CBS INTERACTIVE INC. ALL RIGHTS RESERVED.
20 POWERSHELL CMDLETS YOU CAN USE INSTEAD OF CMD COMMANDS
*Note: PowerShell cmdlet will also delete folders, not just files.
4
COPYRIGHT ©2018 CBS INTERACTIVE INC. ALL RIGHTS RESERVED.
20 POWERSHELL CMDLETS YOU CAN USE INSTEAD OF CMD COMMANDS
STARTING POINT
While this list is in no way exhaustive, it’s a good first step toward treading PowerShell’s relatively deep waters in
a way that allows you to get hands-on experience using it. It also provides a good jumping-off point for those
who want to navigate further into PS and learn more about how its cmdlets can be be used for greater manage-
ability and to automate daily, repetitive tasks.
5
COPYRIGHT ©2018 CBS INTERACTIVE INC. ALL RIGHTS RESERVED.
CREDITS
Global Editor in Chief ABOUT TECHREPUBLIC
Jason Hiner
TechRepublic is a digital publication and online community
Editor in Chief, UK that empowers the people of business and technology. It
Steve Ranger
provides analysis, tips, best practices, and case studies
Managing Editor aimed at helping leaders make better decisions about
Bill Detwiler technology.
Staff Writers
Alison DeNisco Rayome
Macy Bayern
Associate Editor Copyright ©2018 by CBS Interactive Inc. All rights reserved. TechRepublic
and its logo are trademarks of CBS Interactive Inc. ZDNet and its logo are
Melanie Wachsman trademarks of CBS Interactive Inc. All other product names or services
identified throughout this article are trademarks or registered trademarks of
Multimedia Producer their respective companies.
Derek Poore