concept anything in category powershell

appears as: nything, Anything
Learn PowerShell Scripting in a Month of Lunches

This is an excerpt from Manning's book Learn PowerShell Scripting in a Month of Lunches.

PowerShell has a hardcoded preference to pass entire objects from the pipeline into a command. Because of that hardcoded preference, it will always attempt to do that before it tries to do anything else. In order to do so, the following must be true:

Try {
    # something here generates an exception
} Catch [Exception.Type.One] {
    # deal with that exception here
} Catch [Exception.Type.Two] {
    # deal with the other exception here
} Catch {
    # deal with anything else here
} Finally {
    # run something else
}

This process creates a hidden directory; we shouldn’t ever need to access it or modify anything in it directly. The initialization process also creates the master branch. Later, we’ll be able to create additional branches:

PowerShell in Depth, Second Edition

This is an excerpt from Manning's book PowerShell in Depth, Second Edition.

You don’t need to restart the shell once you’ve downloaded and updated help; it’ll start using the new help immediately. But we have a great big caveat to alert you to about updating the help: Because the Microsoft-provided PowerShell extensions live in the Windows System32 folder, their help files also must live there. Because System32 is protected, you must be running the shell under elevated credentials in order for Update-Help to have permission to write to the necessary folders. You’ll want to make sure the shell’s window title bar says “Administrator” before running Update-Help. You can run Update-Help as often as you like, but it won’t do anything after the first attempt of the day unless you use the –Force parameter.

Keep this trick in mind: Any command that produces output can be piped to Get-Member to see what members that output had. But once you’ve done this, your output is removed and replaced with Get-Member’s own output. In other words, Get-Member usually needs to be the last thing on the command line, because piping its output to something else doesn’t usually make sense or do anything useful (Select-Object is sometimes useful if you need the member names, for instance).

PowerShell Deep Dives

This is an excerpt from Manning's book PowerShell Deep Dives.

Now read the log in chronological order. You need to be careful; running Enable-PSWSManCombinedTrace and Disable-PSWSManCombinedTrace creates log events for those commands. You might want to run the Enable command and then wait a few minutes before doing anything with remoting. That way, you can tell by the timestamp in the log when the “real” traffic begins. Wait a few more minutes before running the Disable command, again so that you can easily tell when the “real” log traffic ends. Also note that you’ll get information from two logs, WinRM and PowerShell, although reading the .EVT file with Get-WinEvent will grab everything in sequence.