Monday, October 21, 2013

Is there a way to keep a transcript of everything you type in the shell, and save that transcript to a text file?

Is there a way to keep a transcript of everything you type in the shell, and save that transcript to a text file?
Help *transcript*
PS C:\> help *transcript

Name                              Category  Module                    Synopsis                                                                 
----                              --------  ------                    --------                                                                 
Start-Transcript                  Cmdlet    Microsoft.PowerShell.Host Creates a record of all or part of a Windows PowerShell session in a t...
Stop-Transcript                   Cmdlet    Microsoft.PowerShell.Host Stops a transcript.                                                      

You’ve learned that aliases are nicknames for cmdlets; what cmdlets are available to create, modify, export, or import aliases?

You’ve learned that aliases are nicknames for cmdlets; what cmdlets are available to
create, modify, export, or import aliases?
Help *alias
Or
get-command -noun alia
PS C:\Users\m1024032> help *alias

Name                              Category  Module                    Synopsis                                       
----                              --------  ------                    --------                                       
Export-Alias                      Cmdlet    Microsoft.PowerShell.U... Exports information about currently defined ...
Get-Alias                         Cmdlet    Microsoft.PowerShell.U... Gets the aliases for the current session.      
Import-Alias                      Cmdlet    Microsoft.PowerShell.U... Imports an alias list from a file.             
New-Alias                         Cmdlet    Microsoft.PowerShell.U... Creates a new alias.                           
Set-Alias                         Cmdlet    Microsoft.PowerShell.U... Creates or changes an alias (alternate name)...
Alias                             Provider  Microsoft.PowerShell.Core Provides access to the Windows PowerShell al...

What cmdlet might you use to write to an event log?

What cmdlet might you use to write to an event log?

get-command -verb write -noun eventlog
Or if you weren’t sure about the noun, use a wildcard:
help *log
PS C:\Users\m1024032> help *log

Name                              Category  Module                    Synopsis                                       
----                              --------  ------                    --------                                       
Clear-EventLog                    Cmdlet    Microsoft.PowerShell.M... Deletes all entries from specified event log...
Get-EventLog                      Cmdlet    Microsoft.PowerShell.M... Gets the events in an event log, or a list o...
Limit-EventLog                    Cmdlet    Microsoft.PowerShell.M... Sets the event log properties that limit the...
New-EventLog                      Cmdlet    Microsoft.PowerShell.M... Creates a new event log and a new event sour...
Remove-EventLog                   Cmdlet    Microsoft.PowerShell.M... Deletes an event log or unregisters an event...
Show-EventLog                     Cmdlet    Microsoft.PowerShell.M... Displays the event logs of the local or a re...
Write-EventLog                    Cmdlet    Microsoft.PowerShell.M... Writes an event to an event log.                

 

How many cmdlets are available for working with processes?

How many cmdlets are available for working with processes?

Name                              Category  Module                    Synopsis                                       
----                              --------  ------                    --------                                       
Debug-Process                     Cmdlet    Microsoft.PowerShell.M... Debugs one or more processes running on the ...
Get-Process                       Cmdlet    Microsoft.PowerShell.M... Gets the processes that are running on the l...
Start-Process                     Cmdlet    Microsoft.PowerShell.M... Starts one or more processes on the local co...
Stop-Process                      Cmdlet    Microsoft.PowerShell.M... Stops one or more running processes.           
Wait-Process                      Cmdlet    Microsoft.PowerShell.M... Waits for the processes to be stopped before...


Get-command –noun process
Or
Help *Process

Are there any cmdlets that can redirect output into a file, or to a printer?

Are there any cmdlets that can redirect output into a file, or to a printer?

Help file
Out-File
Out-printer

Can you find any cmdlets capable of converting other cmdlets’ output into HTML?

Can you find any cmdlets capable of converting other cmdlets’ output into HTML?

Help *html*
Or you could try with Get-Command:
get-command -noun html

powershell : Help and get-command

Like the Help cmdlet, Get-Command accepts wildcards, meaning you can run something
like Gcm *event* to see all of the commands that contain “event” in their
name. For better or worse, that list will include not only cmdlets, but also external
commands like netevent.dll, which may not be useful.

powershell : Using help to find commands

Using help to find commands
For example, suppose you want to do something with an event log. You don’t know
what commands might be available, and you decide to search for help topics that
cover event logs. You might run either of these two commands:
Help *log*
Help *event*
The first of these commands returns a list like the following on your computer:
Name Category Module
---- -------- ------
Clear-EventLog Cmdlet Microsoft.PowerShell.M...
Get-EventLog Cmdlet Microsoft.PowerShell.M...
Limit-EventLog Cmdlet Microsoft.PowerShell.M...
New-EventLog Cmdlet Microsoft.PowerShell.M...
Remove-EventLog Cmdlet Microsoft.PowerShell.M...
Show-EventLog Cmdlet Microsoft.PowerShell.M...
Write-EventLog Cmdlet Microsoft.PowerShell.M...
Get-AppxLog Function Appx
Get-DtcLog Function MsDtc
Reset-DtcLog Function MsDtc
Set-DtcLog Function MsDtc
Get-LogProperties Function PSDiagnostics
Set-LogProperties Function PSDiagnostics
about_Eventlogs HelpFile
about_Logical_Operators HelpFile

NOTE You’ll notice that the preceding list includes commands (and functions)
from modules like Appx, MsDtc, and so forth. The help system displays
all of these even though you haven’t loaded those extensions into memory
yet, which helps you discover commands on your computer that you might
otherwise have overlooked. It’ll discover commands from any extensions that
are installed in the proper location,
Once you have a cmdlet that you think will do the job (Get-EventLog looks like a
good candidate for what you’re after in the example), you can ask for help on that
specific topic:
Help Get-EventLog

Powershell ISE : The More command won’t work in the ISE

The More command won’t work in the ISE. Even if you use Help or Man,
the help content displays all at once rather than a page at a time.

Powershell : Within the shell’s console window, Ctrl-C always means “break”

Within the shell’s console window, Ctrl-C always means “break”
rather than “copy to the clipboard.” But in the more graphically oriented Windows
PowerShell ISE, Ctrl-C does copy to the clipboard. A red “stop” button in the toolbar
will stop a running command.

powershell : Technically, Help is a function, and Man is an alias, or nickname, for

The Man keyword (which comes from Unix and means “Manual”).
Man and Help aren’t native cmdlets at all—they are functions, which are wrappers
around the core Get-Help cmdlet.

Technically, Help is a function, and Man is an alias, or nickname, for
Help. But you get the same results using either

powershell: finding cmdlet with help

 It’s impossible to miss the fact that you don’t have local help installed–
the first time you ask for help, PowerShell will prompt you to update the help
content.
Updating PowerShell’s help should be your first task. These files are stored in the
System32 directory, which means your shell must be running under elevated privileges.
If it doesn’t say “Administrator” in the PowerShell title bar, you’ll likely get an
error message:
PS C:\> update-help
Update-Help : Failed to update Help for the module(s)
'Microsoft.PowerShell.Management, Microsoft.PowerShell.Utility,
Microsoft.PowerShell.Diagnostics, Microsoft.PowerShell.Core,
Microsoft.PowerShell.Host, Microsoft.PowerShell.Security,
Microsoft.WSMan.Management' : This command did not update help topics for
the Windows PowerShell core commands or for any modules in the
$pshome\Modules directory. To update these help topics, start Windows
PowerShell with the "Run as Administrator" option and try the command
again.
At line:1 char:1
+ update-help
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Update-Help], Except
ion
+ FullyQualifiedErrorId : UpdatableHelpSystemRequiresElevation,Micros
oft.PowerShell.Commands.UpdateHelpCommand
We’ve boldfaced the important part of the preceding error message—it tells you what
the problem is and how to solve it. Run the shell as administrator, run Update-Help
again, and you’ll be good to go in a few minutes.

Powershell : command vs. cmdlet

Powershell

command vs. cmdlet
PowerShell contains many different types of executable commands. Some are called
cmdlets, some are called functions, others are known as workflows, and so on. Collectively,
they’re all commands

Featured Posts

Adding Accesspolicy to KeyVault for Service Principal Using Portal and Powershell

  Scripts path : https://drive.google.com/drive/folders/1sbBpnVFgXhUIXLdf2E9heyWDeU2f9427?usp=sharing  Adding Accesspolicy to KeyVault for S...