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.

Tuesday, March 26, 2013

Merge-ParameterData

 

Current Version: 1.0

 

.SYNOPSIS

Compares the properties of an object with the parameters of a cmdlet.

 

.DESCRIPTION

Takes an object and examines the properties of the object and the parameters

of a cmdlet.  It then produces an object in the pipeline of any properties

from the object that match a parameter of the cmdlet.  Any properties from the

object that do not have a matching parameter in the cmdlet will be dropped.

 

===============================================================================

== Cmdlet: Merge-ParamarterData                                              ==

== Version 1.0                                                     ==

==---------------------------------------------------------------------------==

== Author: Jason A. Yoder                                                    ==

== Company: MCTExpert, Inc.                                                  ==

== Blog: MCTExpert.Blogspot.com                                              ==

== Twitter: @JasonYoder_MCT                                                  ==

==---------------------------------------------------------------------------==

== License Information:                                                      ==

== Copyright 2013 - MCTExpert, Inc.                                          ==

== This code is licensed for personal use only.  This code may not be        ==

== re published or distributed in whole or in part without the express       ==

== written consent of MCTExpert, Inc.  All rights reserved.                  ==

==---------------------------------------------------------------------------==

== Disclaimer: The user takes full responsibility for the execution of any   ==

== PowerShell code.  This code is provided without warranty or support.      ==

== As with all PowerShell code, review it and test it in a test environment  ==

== prior to using it in a production environment.  The user takes complete   ==

== responsibility for the results of executing this code.                    ==

===============================================================================

 

.PARAMETER Data

The object that you want to example to send to the cmdlet.

 

.PARAMETER Cmdlet

The cmdlet that you want to send the object to.

 

.EXAMPLE

IMPORT-CSV "C:\Process.csv" |

Merge-ParameterData -Cmdlet Get-Process|

Get-Process

 

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName                                                                                      

-------  ------    -----      ----- -----   ------     -- -----------                                                                                      

    398      30    10664      11580   156    44.98   3472 ANT Agent                                                                                        

     76      18     6560       7052    84     0.64   7024 calc                                                                                             

   1157      70    64452      94348   399    27.28   7504 explorer

 

Takes a CSV file and compares the property names of the imported objects

to the parameter list of Get-Process.  It them pipes the results to

Get-Process.

 

.EXAMPLE

Import-Csv C:\PS\Contacts.csv | Mearger-ParameterData -Cmdlet New-MailContact |

ForEach -Process {New-MailContact -Name $_.Name -DisplayName $_.DisplayName `

 -ExternalEmailAddress $_.ExternalEmailAddress}

 

Creates mail contacts from a CSV file. The New-MailContact cmdlet

does not accept input from the pipeline on the Name or the ExternalEmailAddress

Parameters.  This example shows you how to get around this issue.

 

Wednesday, January 23, 2013

Get-HDComputerInfo

 

Module: HelpDesk

This cmdlet is part of a module that I use for accelerating the resolution of issues at the help desk.

Example Output:

 

Report generated on: 01/23/2013 14:28:53                                        

ComputerName: Test-PC1                                                      

Currently Logged on User: Test-PC1\Jason                                        

Operating System Information                                                    

Operating System  : Microsoft Windows 7 Ultimate                                

Version           : 6.1.7601                                                    

Windows Directory : C:\windows                                                  

Registered user   : Jason                                                       

Serial Number     : 00426-068-1063837-86057                                     

SPMajorVersion    : 1                                                           

SPMinorVersion    : 0                                                           

Local hard Drive Status                                                         

Drive %free   FreeSpace (GB)                                                    

C:     19.80  44.51                                                             

D:     94.91  213.34                                                            

Difference between the client clock and yours (Min):unknown                     

Stability Index (1 = Low, 10 = High):8.419                                        

Last system start time: 1/16/2013 2:39:56 PM                                    

Hardware Information:                                                           

Manufacturer:  FUJITSU                                                          

Model:  LIFEBOOK AH530                                                          

System Type:  x64-based PC                                                      

System Category: Mobile                                                         

Boot up state: Normal Boot                                                      

Power Supply State: Unknown                                                      

Thermal State: Unknown                                                          

Number of Processors: 1                                                         

Number of Logical Processors: 4                                                 

Physical Memory: 4 GB                                                           

System Restore Enabled: True                                                    

Group Policy Information                                                        

Computer GPO Applied At   :                                                     

Computer GPO Applied From :                                                     

Applied Computer GPOs     :                                                     

N/A                                                                             

User GPO Applied          :  Unknown                                            

User GPO applied From     :                                                     

Applied User GPOs         :                                                     

N/A                                                                             

Running Programs                                                                

Memory(MB)      Name                                                            

518.2734375     powershell_ise.exe                                              

210.55078125    chrome.exe                                                      

178.0625        OUTLOOK.EXE                                                     

157.44921875    svchost.exe                                                     

114.41796875    csrss.exe                                                       

100.41015625    chrome.exe                                                      

98.16015625     chrome.exe                                                      

87.93359375     explorer.exe                                                    

84.6796875      WindowsLiveWriter.exe                                           

83.046875       dwm.exe                                                         

80.31640625     WINWORD.EXE                                                     

78.4609375      chrome.exe                                                      

61.65625        wsmprovhost.exe                                                 

58.9140625      chrome.exe                                                      

56.64453125     svchost.exe                                                     

51.6796875      EXCEL.EXE                                                       

49.28515625     chrome.exe                                                      

41.9140625      powershell.exe                                                  

39.70703125     chrome.exe                                                      

37.44140625     gimp-2.6.exe                                                    

35.08203125     MsMpEng.exe                                                     

31.57421875     chrome.exe                                                      

29.84765625     chrome.exe                                                      

29.4921875      chrome.exe                                                      

28.1015625      chrome.exe                                                      

27.484375       chrome.exe                                                      

27.33203125     chrome.exe                                                      

26.39453125     chrome.exe                                                      

25.9375         iexplore.exe                                                    

25.81640625     SearchIndexer.exe                                               

25.1796875      chrome.exe                                                      

19.3671875      chrome.exe                                                      

18.765625       POWERPNT.EXE                                                    

18.57421875     chrome.exe                                                      

18.42578125     chrome.exe                                                      

18.01953125     chrome.exe                                                      

17.13671875     chrome.exe                                                      

15.6875         svchost.exe                                                     

15.2890625      SkyDrive.exe                                                    

14.2578125      WmiPrvSE.exe                                                    

14.16015625     wmpnetwk.exe                                                    

14.09765625     svchost.exe                                                     

12.2421875      svchost.exe                                                     

12.19140625     WmiPrvSE.exe                                                    

11.06640625     chrome.exe                                                      

10.5            NisSrv.exe                                                      

10.23828125     chrome.exe                                                      

10.08203125     chrome.exe                                                      

9.921875        iexplore.exe                                                    

9.90625         chrome.exe                                                      

9.72265625      svchost.exe                                                     

9.46875         lsass.exe                                                       

9.34375         script-fu.exe                                                   

9.328125        googletalk.exe                                                   

8.7578125       svchost.exe                                                     

8.6015625       chrome.exe                                                      

8.484375        sqlservr.exe                                                    

8.33203125      msnmsgr.exe                                                     

7.6171875       chrome.exe                                                      

6.68359375      chrome.exe                                                      

6.56640625      chrome.exe                                                      

6.46875         LogMeIn.exe                                                     

6.42578125      SnippingTool.exe                                                

6.2734375       svchost.exe                                                     

6.19140625      services.exe                                                    

6.01953125      WmiPrvSE.exe                                                    

5.453125        PdaNetPC.exe                                                    

5.2578125       OSPPSVC.EXE                                                     

5.125           taskeng.exe                                                     

4.68359375      MSOSYNC.EXE                                                     

4.63671875      svchost.exe                                                     

4.4765625       taskhost.exe                                                    

4.4296875       msseces.exe                                                     

4.41015625      spoolsv.exe                                                     

4.40234375      ANT Agent.exe                                                   

4.25            ipoint.exe                                                      

4.21484375      LogMeInSystray.exe                                              

4.0625          SynTPEnh.exe                                                    

3.5859375       igfxpers.exe                                                    

3.56640625      lxeccoms.exe                                                    

3.34375         lxedcoms.exe                                                    

3.02734375      notepad.exe                                                     

3.01953125      wisptis.exe                                                     

3.00390625      IndicatorUty.exe                                                

2.90234375      chrome.exe                                                      

2.6875          conhost.exe                                                     

2.6875          WLIDSVC.EXE                                                     

2.63671875      UNS.exe                                                         

2.63671875      LMS.exe                                                         

2.5859375       lsm.exe                                                         

2.4921875       igfxsrvc.exe                                                    

2.47265625      AdobeARM.exe                                                    

2.31640625      iTunesHelper.exe                                                

2.29296875      TSVNCache.exe                                                   

2.2734375       rundll32.exe                                                    

2.1640625       mDNSResponder.exe                                               

2.078125        ZoomIt64.exe                                                    

2.05078125      lxecmon.exe                                                     

2.01953125      ezprint.exe                                                     

1.953125        iPodService.exe                                                 

1.953125        lxedmon.exe                                                     

1.83984375      winlogon.exe                                                    

1.80859375      TSVNCache.exe                                                   

1.76953125      svchost.exe                                                     

1.76953125      itype.exe                                                       

1.73046875      BtnHnd.exe                                                      

1.71875         jusched.exe                                                     

1.70703125      ZoomIt.exe                                                      

1.67578125      AppleMobileDeviceService.exe                                    

1.609375        svchost.exe                                                     

1.58203125      hkcmd.exe                                                       

1.5703125       svchost.exe                                                     

1.56640625      taskhost.exe                                                    

1.51953125      igfxtray.exe                                                    

1.50390625      RAVCpl64.exe                                                    

1.43359375      TrayManager.exe                                                 

1.3828125       csrss.exe                                                       

1.359375        ConMgr.exe                                                      

1.31640625      CSRBthFtpServer.exe                                             

1.2265625       TeamViewer_Service.exe                                          

1.0859375       FUJ02E3.exe                                                     

1.05078125      System                                                          

0.98828125      ibsvc.exe                                                       

0.96484375      FdmDaemon.exe                                                   

0.95703125      PDVD8Serv.exe                                                   

0.9375          svchost.exe                                                     

0.9296875       dllhost.exe                                                     

0.91015625      LMIGuardianSvc.exe                                              

0.8984375       updatenv.exe                                                    

0.8828125       FlashUtil32_11_5_502_146_ActiveX.exe                            

0.87890625      YouCamTray.exe                                                  

0.87890625      CSRSkype.exe                                                    

0.87109375      BtnHndHkb.exe                                                   

0.81640625      RichVideo.exe                                                   

0.72265625      sqlwriter.exe                                                   

0.69140625      McciCMService.exe                                               

0.66015625      VFPRadioSupportService.exe                                      

0.625           McciCMService.exe                                               

0.5703125       ramaint.exe                                                     

0.515625        svchost.exe                                                     

0.515625        ielowutil.exe                                                   

0.4765625       QuickTouch.exe                                                  

0.46875         ONENOTEM.EXE                                                    

0.45703125      SynTPHelper.exe                                                 

0.41796875      mfevtps.exe                                                     

0.3828125       splwow64.exe                                                    

0.33203125      PSUService.exe                                                  

0.23046875      updnvsrv.exe                                                    

0.2109375       WLIDSVCM.EXE                                                    

0.2109375       wininit.exe                                                     

0.15234375      smss.exe                                                        

0.0234375       System Idle Process                                             

Software installations                                                          

Software  :                                                                     

Date/Time :                                                                     

Source    :                                                                     

Status    :                                                                     

Message   :                                                                     

User      :                                                                     

---------------------------------------------------------------------------------

Application Errors                                                              

Date/Time   :                                                                   

ProductName :                                                                   

User        :                                                                   

---------------------------------------------------------------------------------

Application Hang                                                                

Date/Time   :                                                                   

ProductName :                                                                   

User        :                                                                   

---------------------------------------------------------------------------------

Windows Updates                                                                 

Date/Time   :01/22/2013 21:11:40                                                

ProductName :Definition Update for Microsoft Security Essentials - KB2310138 (Definition 1.143.555.0)

Message     :Installation Successful: Windows successfully installed the following update: Definition Update for Microsoft Security Essentials - KB

2310138 (Definition 1.143.555.0)

----------------------------------------------------------------------------------

Application Log                                                                 

Level     :Error                                                                

Date/Time :01/23/2013 08:57:43                                                  

Message   :mDNSCoreMachineSleep: mDNS_Unlock: Locking failure! mDNS_busy (1) != mDNS_reentrancy (0)

---------------------------------------------------------------------------------

Level     :Error                                                                

Date/Time :01/23/2013 08:57:43                                                  

Message   :mDNSCoreMachineSleep: mDNS_Lock: Locking failure! mDNS_busy (1) != mDNS_reentrancy (0)

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:07                                                  

Message   :Certificate for local system with Thumbprint 51 af a6 6e 25 5d e9 7e 95 f1 14 7d ac 7c 53 8e ae e2 ee 37 is about to expire or already e

xpired.

---------------------------------------------------------------------------------

Level     :  Unknown                                                            

Date/Time :01/22/2013 21:01:16                                                  

Message   :                                                                     

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/22/2013 15:21:46                                                  

Message   :Certificate for local system with Thumbprint 51 af a6 6e 25 5d e9 7e 95 f1 14 7d ac 7c 53 8e ae e2 ee 37 is about to expire or already e

xpired.

---------------------------------------------------------------------------------

System Log                                                                      

Level     :Warning                                                              

Date/Time :01/23/2013 11:11:35                                                  

Message   :Name resolution for the name www.mms-2011.com timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:05                                                  

Message   :Name resolution for the name www.google.com timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:05                                                  

Message   :Name resolution for the name teredo.ipv6.microsoft.com timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:04                                                  

Message   :Name resolution for the name wpad.gateway.2wire.net timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:02                                                  

Message   :Name resolution for the name wpad.gateway.2wire.net timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/23/2013 08:57:00                                                  

Message   :Name resolution for the name isatap.gateway.2wire.net timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Warning                                                              

Date/Time :01/22/2013 20:59:53                                                  

Message   :Name resolution for the name xoqbgpmltg.gateway.2wire.net timed out after none of the configured DNS servers responded.

---------------------------------------------------------------------------------

Level     :Error                                                                

Date/Time :01/22/2013 20:59:50                                                  

Message   :A timeout (30000 milliseconds) was reached while waiting for a transaction response from the ShellHWDetection service.

---------------------------------------------------------------------------------

USB Device information                                                          

Name          : USB Root Hub                                                     

Status        : OK                                                               

Status        : USB\ROOT_HUB20\4&34A2E03&0                                       

DeviceID      :                                                                  

Name          : Generic USB Hub                                                  

Status        : OK                                                               

Status        : USB\VID_8087&PID_0020\5&912EB71&0&1                              

DeviceID      :                                                                  

Name          : USB Input Device                                                 

Status        : OK                                                               

Status        : USB\VID_0461&PID_4D0F\6&38B58C2F&0&5                             

DeviceID      :                                                                  

Name          : HID-compliant mouse                                              

Status        : OK                                                               

Status        : HID\VID_0461&PID_4D0F\7&25733AA4&0&0000                          

DeviceID      :                                                                  

Name          : USB Root Hub                                                     

Status        : OK                                                               

Status        : USB\ROOT_HUB20\4&2666A9D5&0                                      

DeviceID      :                                                                  

Name          : Generic USB Hub                                                  

Status        : OK                                                               

Status        : USB\VID_8087&PID_0020\5&2D36E645&0&1                             

DeviceID      :                                                                  

Name          : USB Composite Device                                             

Status        : OK                                                               

Status        : USB\VID_0408&PID_1FC3\SN001                                      

DeviceID      :                                                                  

Name          : HD Webcam                                                        

Status        : OK                                                               

Status        : USB\VID_0408&PID_1FC3&MI_00\7&1EAC75B1&0&0000                    

DeviceID      :                                                                  

Name          : Generic Bluetooth Adapter                                        

Status        : OK                                                               

Status        : USB\VID_1690&PID_0741\6&3A1F1EB&0&2                              

DeviceID      :                                                                  

Name          : Bluetooth Device (RFCOMM Protocol TDI)                           

Status        : OK                                                               

Status        : BTH\MS_RFCOMM\7&3231F531&0&0                                     

DeviceID      :                                                                  

Name          : Standard Modem over Bluetooth link                               

Status        : OK                                                               

Status        : BTHENUM\{00001103-0000-1000-8000-00805F9B34FB}_VID&0002000A_PID&0000\8&C0CC3E3&0&D03761A29842_C00000000

DeviceID      :                                                                  

Name          : Microsoft Bluetooth Enumerator                                   

Status        : OK                                                               

Status        : BTH\MS_BTHBRB\7&3231F531&0&1                                     

DeviceID      :                                                                  

Name          : MCT (Remote Control)                                             

Status        : OK                                                               

Status        : BTHENUM\{0000110E-0000-1000-8000-00805F9B34FB}_VID&0002000A_PID&0000\8&2A861912&0&D03761A29842_C00000000

DeviceID      :                                                                  

Name          : HID-compliant consumer control device                            

Status        : OK                                                               

Status        : HID\BTHAVRCPDEVICE&COL01\9&3451B562&0&0000                       

DeviceID      :                                                                  

Name          : HID-compliant device                                             

Status        : OK                                                               

Status        : HID\BTHAVRCPDEVICE&COL02\9&3451B562&0&0001                       

DeviceID      :                                                                  

Name          : HID-compliant device                                             

Status        : OK                                                               

Status        : HID\BTHAVRCPDEVICE&COL03\9&3451B562&0&0002                       

DeviceID      :                                                                  

Name          : Bluetooth Peripheral Device                                      

Status        : Error                                                            

Status        : BTHENUM\{00001132-0000-1000-8000-00805F9B34FB}_VID&0002000A_PID&0000\8&2A861912&0&D03761A29842_C00000000

DeviceID      :                                                                  

Name          : Bluetooth Device (Personal Area Network)                         

Status        : OK                                                               

Status        : BTH\MS_BTHPAN\7&3231F531&0&2                                     

DeviceID      :                                                                  

---------------------------------------------------------------------------------

-- CMDLET: get-HDComputerInfo                                                  --

-- Helpdask Module                                                             --

-- Copywrite 2013 MCTExpert, Inc.                                              --

---------------------------------------------------------------------------------

Demo code provided without warranty or 

support.  As with all PowerShell code, 

review it and test it in a test        

environment prior to using it in a     

production environment.                

 

Help file:

.SYNOPSIS
Retrieves Help Desk type information from clients.

.DESCRIPTION
Retrieves Help Desk type information from clients. 

This cmdlet is intended to be used as a demonstration technology to show
how PowerShell can be used to help reduce help desk support call time by
presenting the support technician with valuable information about the
client in question without asking the user for the information.

This code does not change information.  It will only retrieve information.

===============================================================================
== Cmdlet: Get-Get-HDComputerInfo                                            ==
== Module: HelpDesk                                                          ==
==---------------------------------------------------------------------------==
== Author: Jason A. Yoder                                                    ==
== Company: MCTExpert, Inc.                                                  ==
== Blog: MCTExpert.Blogspot.com                                              ==
== Twitter: @JasonYoder_MCT                                                  ==
==---------------------------------------------------------------------------==
== License Information:                                                      ==
== Copyright 2013 - MCTExpert, Inc.                                          ==
== This code is licensed for personal use only.  This code may not be        ==
== re published or distributed in whole or in part without the express       ==
== written consent of MCTExpert, Inc.  All rights reserved.                  ==
==---------------------------------------------------------------------------==
== Disclaimer: The user takes full responsibility for the execution of any   ==
== PowerShell code.  This code is provided without warranty or support.      ==
== As with all PowerShell code, review it and test it in a test environment  ==
== prior to using it in a production environment.  The user takes complete   ==
== responsibility for the results of executing this code.                    ==
===============================================================================

.PARAMETER ComputerName

The name of the client that you want to gather data on.

.PARAMETER Days

The number of days you want this cmdlet to retrieve information from
the reliability monitor and the event logs.

.PARAMETER GPO

Returns information on the Group Policies that are applied
to the client.

.PARAMETER EventLogs

Returns information from the System and Application logs on the client.

.PARAMETER Full

Runs all tests and returns the maximum amount of information from
the client.

.PARAMETER Name

The name of the client that you want to gather data on. provided to allow
for easy compatibility with the Get-ADComputer cmdlet from the
ActiveDirectory module.

.PARAMETER PassThru

Returns the new or modified object. By default (i.e. if -PassThru is not
specified), this cmdlet does not generate any output.

.PARAMETER Programs

Returns information on the programs currently running on the client.

.Parameter Quiet

Be default, this cmdlet will display user friendly information.  This
switch will suppress this information.

.PARAMETER USB

Returns information on the USB devices built in and attached to the client.

.EXAMPLE
Get-HDComputerInfo -computername "Lab1"

Returns a basic set of information from the client Lab1.

.EXAMPLE
Get-HDComputerInfo -computername "Lab1" -days 5 -Full -passthru

Runs the maximum amount of information from a client called Lab1. This cmdlet
will also return 5 days worth of information of the Event Logs and the
Reliability Monitor.  The full object will also be placed in the PowerShell
pipeline.

.EXAMPLE
Get-HDComputerInfo -Computername "Indy1", "Indy2"

Returns basic Help Desk information on clients Indy1 and Indy2 if they
are online.

.EXAMPLE
Get-ADComputer -Filter 'Name -like "SEA*"' | Get-HDComputerInfo -quiet -PassThru

Returns the objet data from the basic test from everyone computer in your
environment that starts with "SEA" and is online.

.EXAMPLE
Get-ADComputer -Filter 'Name -like "SEA*"' |
Get-HDComputerInfo -quiet -PassThru |
Where-Object {$_.PhysicalMemoryGB -eq 16} |
Select-Object -Property ComputerName


ComputerName                                                                                                                                
------------                                                                                                                                
SEA1                                                                                                                                        
SEA2-HV              

Test all clients in your environment that have a name that starts with SEA.
If these clients have at least 16 GB of memory, then their names are sent into
the pipeline. 

.NOTES
This cmdlet requires PowerShell V2 or V3 to be installed on the source and
target computers. PowerShell Remoting also needs to be turned on in your
environment. For instructions on how to turn on PowerShell remoting, please
refer to this blog article:
http://MCTExpert.Blogspot.com/2011/03/enable-powershell-v2-remote-management.html


This cmdlet is intended to be used as a demonstration technology to show
how PowerShell can be used to help reduce help desk support call time by
presenting the support technician with valuable information about the
client in question without asking the user for the information.