Power Help Files

This blog holds my PowerShell help files for those who have attended my classes. As I add new PowerShell help files into my classes, the online help will be located here.

If you like what you see, contact me and I'll let you know where I am instructing my next class.

Wednesday, October 31, 2012

Find-NullProperty

 

Last Update: October 31, 2012
PowerShell Version: 2.0 and 3.0

Libraries:

  • PSv3.psm1

.SYNOPSIS

Indicates if an object has a property that is $NULL

 

.DESCRIPTION

Search through a collection of custom objects and returns the index

number of any instance that has a $NULL value in a NoteProperty

 

.PARAMETER Object

The Object, or collection of objects that may contain a NULL value

in a note property.

 

.EXAMPLE

Find-NullProperty $Object

 

Index

-----

1

2

 

Returns the index number of instance of a collection of object in which

a NoteProperty has a NULL value.

 

.NOTES

Provided without warranty or support.

Author: Jason Yoder.

 

Sunday, October 21, 2012

Get-Process2

Last Update: October 21, 2012
PowerShell Version: 2.0 and 3.0

Libraries:

  • PSv3.psm1

.SYNOPSIS
Returns process information on local and remote clients.

.DESCRIPTION
Returns process information on local and remote clients, but includes
the computer name.

.PARAMETER ComputerName
The name or names of the computers that you want to return process
information from.

.PARAMETER Quiet
Suppresses error messages.

.PARAMETER FullDetail
Returns the entire process object.  The default will return the
same information as Get-Process.

.EXAMPLE
Get-Process2  -ComputerName "Srv01", "Svr2", "Svr3"

Returns the same information as Get-Process, but also includes the
name of the source the data came from.

.EXAMPLE
Get-Process2  -ComputerName "Srv01", "Svr2", "Svr3" -Quiet

Returns the same information as Get-Process, but also includes the
name of the source the data came from. Any errors generated while
attempting to contact the clients will be suppressed.

.EXAMPLE
Get-Process2  -ComputerName "Srv01", "Svr2", "Svr3" -FullDetail
Returns the entire Process object for each object on each server contacted.
This will return a very large amount of data.

.NOTES
-------------------------------------------------------------------------------
Provided as is with no warranty or support.
Jason Yoder, MCT  -  MCTExpert, Inc.
-------------------------------------------------------------------------------

Thursday, October 18, 2012

Download-HTML

Last Update: October 18, 2012
PowerShell Version: 2.0 and 3.0

Libraries:

  • PSv3.psm1

.SYNOPSIS
Saves HTML source code from the web to a file on your hard drive.

.DESCRIPTION
Allows you to specify a website and download the source code.

.PARAMETER Source
The website that you want to download the source code from.

.PARAMETER SaveFile
The destination path and file name that you want to save the source code to.

.PARAMETER Quiet
Suppresses on screen messages.

.EXAMPLE
Download-HTML -Source "www.MCTExpert.com" -SaveFile "C:\Data\Code.html"

Downloads the code from the web page www.MCTExpert.com and saves it to the
local hard drive in the Data folder as Code.html.

Monday, October 15, 2012

Backup-EventLog

Search-Help

Last Update: October 15, 2012
PowerShell Version: 2.0 and 3.0

Libraries:

  • PSv3.psm1

 

.SYNOPSIS
Allows for the backing up and clearing of event logs.

.DESCRIPTION
Allows for the backing up and clearing of multiple event logs on multiple
Clients and Servers.  The event logs will be copied to the location
specified in the PATH parameter.  The cmdlet will automatically
create a file structure for Year and then month. 

The backed up files Names will have the format
Server-Log-Day-Hour-Minute to help denote separate backups
in the Month folders.

Logs are not cleared unless the CLEAR switch is invoked.

To work with the Security Log, the user must be running PowerShell
As an Administrator.


.PARAMETER ClearLog
Clears the log if the backup was successful.

.PARAMETER ComputerName
List of computer names in which to attempt a backup of event log data.

.PARAMETER LogFiles
List of all event logs to attempt to backup.

.PARAMETER Path
The root destination path to store the backup logs in.

.PARAMETER Quiet
Suppresses all information and warning messages.

.NOTES
===============================================================================
Copyright 2012 MCTExpert, Inc.
Licensed for use by participants from classes delivered by Jason Yoder.

This script is provided without support, warranty, or guarantee.
User assumes all liability for cmdlet results.
===============================================================================

.EXAMPLE
Backup-EventLog -ComputerName Indy-DC1 -LogFiles Security, Application -Path f:\Logs
 
Backs up the Security and Application Logs from server Indy-DC1 to the path f:\Logs.

.EXAMPLE
Backup-EventLog -ComputerName Indy-DC1, Indy-CLI1, LON-SVR2 -LogFiles System -Path "\\LON-SVR1\Logs" -ClearLog| Where-Object {$_.online -eq $True}

ComputerName    : Indy-DC1
Online          : True
System_Exists   : True
System_BackedUp : True
System_Cleared  : True

ComputerName    : Indy-SVR2
Online          : True
System_Exists   : True
System_BackedUp : True
System_Cleared  : True

Returns all clients eventlog backup information for clients that were online and connected.

.EXAMPLE
PS F:\code> Backup-EventLog -ComputerName Indy-DC1, Indy-CLI1, Indy-SVR2 -LogFiles System -Path "\\Indy-SVR1\Logs" -ClearLog | FT


ComputerName Online System_Exists System_BackedUp System_Cleared
------------ ------ ------------- --------------- --------------
Indy-DC1     True   True          True             True
Indy-CLI1    False  False         False            False
Indy-SVR2    True   True          True             True
 
 
.EXAMPLE
Backup-EventLog -ComputerName Indy-DC1, Indy-CLI1, Indy-SVR2 -LogFiles System, application, Security -Path "\\Indy-SVR1\Logs" -ClearLog -Quiet

ComputerName         : Indy-DC1
Online               : True
System_Exists        : True
System_BackedUp      : True
System_Cleared       : True
application_Exists   : True
application_BackedUp : True
application_Cleared  : True
Security_Exists      : True
Security_BackedUp    : True
Security_Cleared     : True

ComputerName         : Indy-CLI1
Online               : False
System_Exists        : False
System_BackedUp      : False
System_Cleared       : False
application_Exists   : False
application_BackedUp : False
application_Cleared  : False
Security_Exists      : False
Security_BackedUp    : False
Security_Cleared     : False

ComputerName         : Indy-SVR2
Online               : True
System_Exists        : True
System_BackedUp      : True
System_Cleared       : True
application_Exists   : True
application_BackedUp : True
application_Cleared  : True
Security_Exists      : True
Security_BackedUp    : True
Security_Cleared     : True

Backups and clears all System, Application, and Security events on server
Indy-DC, Indy-CLI1, and Indy, SVR2.  The logs are backup on Indy-SVR2. 
All status messages are suppressed.


#>

}

Wednesday, October 3, 2012

Search-Help

Last Update: October 3, 2012
PowerShell Version: 2.0 and 3.0

Libraries:

  • PSv3.psm1

 

.SYNOPSIS
Searches PowerShell help files for specific words.

.DESCRIPTION
Searches through PowerShell help files for words and highlights those words in the actual help files. 
The default setting for this cmdlet is to search for the pattern specified in the WORDS parameter in each word of the help file.

.PARAMETER Cmdlet
The cmdlet or About file that you want to search for specific words.

.PARAMETER Words
Comma separated list of words that you want to search for.  The words can contain * and ? characters but cannot start with a * or ? character.

.PARAMETER Detailed
Searches the cmdlets detailed help file.

.PARAMETER Full
Searches the cmdlets full help file.

.PARAMETER MoreHighlight
Displays the queried words in a higher contrast color scheme which may make the output more readable to some users.

.PARAMETER ExactMatch
This will change the pattern recognition to an exact match (not case sensitive).  Wildcard characters are not accepted.

.EXAMPLE
Search-Help Get-Date -Words Date

Returns the standard help file for the cmdlet Get-Date and highlights all words that match or contains "Date".

NAME

    Get-Date

    

SYNOPSIS

    Gets the current date and time.

    

    

SYNTAX

    Get-Date [[-Date] <DateTime>] [-Day <Int32>] [-DisplayHint <DisplayHintType>] [-Format <String>] [-Hour <Int32>] 

    [-Millisecond <Int32>] [-Minute <Int32>] [-Month <Int32>] [-Second <Int32>] [-Year <Int32>] [<CommonParameters>]

    

    Get-Date [[-Date] <DateTime>] [-Day <Int32>] [-DisplayHint <DisplayHintType>] [-Hour <Int32>] [-Millisecond <Int32>] 

    [-Minute <Int32>] [-Month <Int32>] [-Second <Int32>] [-UFormat <String>] [-Year <Int32>] [<CommonParameters>]

    

    

DESCRIPTION

    The Get-Date cmdlet gets a DateTime object that represents the current date or a date that you specify. It can format the 

    date and time in several Windows and UNIX formats. You can use Get-Date to generate a date or time character string, and 

    then send the string to other cmdlets or programs.

    

 

RELATED LINKS

    Online Version: http://go.microsoft.com/fwlink/?LinkID=113313

    New-TimeSpan 

    Set-Date 

 

REMARKS

    To see the examples, type: "get-help Get-Date -examples".

    For more information, type: "get-help Get-Date -detailed".

    For technical information, type: "get-help Get-Date -full".

    For online help, type: "get-help Get-Date -online"

 

 

 

-- Search Results: -------------------------------------------------------------

Your search returned 20 matches.

Items searched for:

Date

.EXAMPLE
Search-Help Get-Process P*ess, more, t?pe -MoreHighlight

Returns the standard help file for the cmdlet Get-Date and highlights all words that match or contains "Date" as well as "P*ess" and "T?py"
The "*" character is a wild card character that allows for multiple characters to exists in its place.
The "?" character is a wild card character that allows for a single character to exists in its place.
The highlighted words will also be returned in greater contrast.

NAME

    Get-Process

    

SYNOPSIS

    Gets the processes that are running on the local computer or a remote computer.

    

    

SYNTAX

    Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module 

    [<SwitchParameter>]] [<CommonParameters>]

    

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]] -Id <Int32[]> 

    [<CommonParameters>]

    

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]] -InputObject 

    <Process[]> [<CommonParameters>]

    

    

DESCRIPTION

    The Get-Process cmdlet gets the processes on a local or remote computer.

    

    Without parameters, Get-Process gets all of the processes on the local computer. You can also specify a particular process 

    by process name or process ID (PID) or pass a process object through the pipeline to Get-Process.

    

    By default, Get-Process returns a process object that has detailed information about the process and supports methods that 

    let you start and stop the process. You can also use the parameters of Get-Process to get file version information for the 

    program that runs in the process and to get the modules that the process loaded.

    

 

RELATED LINKS

    Online Version: http://go.microsoft.com/fwlink/?LinkID=113324

    Debug-Process 

    Get-Process 

    Start-Process 

    Stop-Process 

    Wait-Process 

 

REMARKS

    To see the examples, type: "get-help Get-Process -examples".

    For more information, type: "get-help Get-Process -detailed".

    For technical information, type: "get-help Get-Process -full".

    For online help, type: "get-help Get-Process -online"

 

 

 

-- Search Results: -------------------------------------------------------------

Your search returned 36 matches.

Items searched for:

P*ess

more

t?pe

.EXAMPLE
Search-Help About_Comparison_Operators "-Match"

Returns the help file for About_Comparison_Operators with all words matching or contains "-Match" highlighted.

.EXAMPLE
Search-Help Get-Process -detailed Process

Returns the detailed help file for the cmdlet Get-Date and highlights all words that match or contains "Date".

.EXAMPLE
Search-Help Get-Process -Words Process -ExactMatch

Returns the standard help file for Get-Process with all words that exactly match "Process" highlighted.

NAME

    Get-Process

    

SYNOPSIS

    Gets the processes that are running on the local computer or a remote computer.

    

    

SYNTAX

    Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module 

    [<SwitchParameter>]] [<CommonParameters>]

    

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]] -Id <Int32[]> 

    [<CommonParameters>]

    

    Get-Process [-ComputerName <String[]>] [-FileVersionInfo [<SwitchParameter>]] [-Module [<SwitchParameter>]] -InputObject 

    <Process[]> [<CommonParameters>]

    

    

DESCRIPTION

    The Get-Process cmdlet gets the processes on a local or remote computer.

    

    Without parameters, Get-Process gets all of the processes on the local computer. You can also specify a particular process 

    by process name or process ID (PID) or pass a process object through the pipeline to Get-Process.

    

    By default, Get-Process returns a process object that has detailed information about the process and supports methods that 

    let you start and stop the process. You can also use the parameters of Get-Process to get file version information for the 

    program that runs in the process and to get the modules that the process loaded.

    

 

RELATED LINKS

    Online Version: http://go.microsoft.com/fwlink/?LinkID=113324

    Debug-Process 

    Get-Process 

    Start-Process 

    Stop-Process 

    Wait-Process 

 

REMARKS

    To see the examples, type: "get-help Get-Process -examples".

    For more information, type: "get-help Get-Process -detailed".

    For technical information, type: "get-help Get-Process -full".

    For online help, type: "get-help Get-Process -online"

 

 

 

-- Search Results: -------------------------------------------------------------

Your search returned 9 matches.

Items searched for:

Process

.NOTES
This cmdlet sends customized output to the host one line at a time.  For this reason, standard object output for PowerShell is not utilized.

.LINK
Online Version: http://get-help-jason-yoder.blogspot.com/2012/10/search-help.html
Get-Help