New
#1
Difference between Windows PowerShell and Command Prompt
Don't these programs do essentially the same thing? Is there an advantage to use one over the other? Just curious.
Don't these programs do essentially the same thing? Is there an advantage to use one over the other? Just curious.
CMD is easier to use (less code), but PS gives you more power/features.
CMD is being slowly deprecated, so MS will move to PS eventually (~5 years).
I wholeheartedly prefer CMD, but I am preparing to move to PS. You might like this:
Code:https://books.goalkicker.com/PowerShellBook/PowerShellNotesForProfessionals.pdf
Powershell is considerably different from the command line interface in Windows. With powershell, you have the ability to use cmdlets which allow you to perform many systems admin tasks, you can modify the registry and utilize WMI (Windows Management Instrumentation). These things cannot be modified via the command line.
Powershell returns everything as an object and you can pipe the objects from one cmdlet through another cmdlet. It acts far more like a programming language.
This command will show you all stopped services on your system.
get-service |Where-Object {$_.status -eq "stopped"}
This will display all processes to you in the color cyan
Get-Process | ForEach-Object {Write-Host $_.name -foregroundcolor cyan}
Want to see who last rebooted your workstation or your server
Get-EventLog –Log System –Newest 1000 | Where-Object {$_.EventID –eq ‘1074’} | FT MachineName, UserName, TimeGenerated -AutoSize