<Execute Powershell script in Regular CMD:>
Example #1: Run a Powershell script in CMD:
cmd > powershell -command "& 'C:\foobar.ps1'"
Example #2: Run a Poswershell command in CMD:
cmd > powershell -command " get-process "
<Get Help Information:>
PS > Get-Help [COMMAND]
Example:
PS > Get-Help Get-Help
PS > Get-Help Get-Command
<Get Cmdlets List:>
PS > Get-Command
<Search Cmdlets:>
PS > Get-Command -Name [PATTERN]
Example:
PS > Get-Command -Name *firewall*
<Get Process Information:>
PS > Get-Process chrome, firefox | Sort-Object -Unique | Format-List Path,Id
<List All Alias Cmdlets:>
PS > Get-Alias -Definition [COMMAND]
Example:
PS > Get-Alias -Definition Get-ChildItem
<Inquire through WMI by using Get-WMIObject:>
Example #1: Inquire Process List
PS > Get-WmiObject -Class Win32_Process
Example #2: Inquire Service List from a remote computer
PS > Get-WmiObject -Class Win32_Service -ComputerName 10.1.4.62
Example #3: Inquire information from a query
PS > Get-WmiObject -Query "select * from win32_service where name='WinRM'" -ComputerName Server01, Server02 | Format-List -Property PSComputerName, Name, ExitCode, Name, ProcessID, StartMode, State, Status