Gets type accelerators in CTP3


posted by Thomas Lee
12-28-2008

Downloads: 372
File size: 2.4kB
Views: 1,732

Embed
Gets type accelerators in CTP3
  1. <# 
  2. .SYNOPSIS 
  3.     Gets a list of Type Accelerators in PowerShell and displays them nicely 
  4. .DESCRIPTION 
  5.     This script is based on Osin's blog article and uses the TypeAccelerator 
  6.     class to return the type accellerators contained in PowerShell 
  7. .NOTES 
  8.     Additional Notes, eg 
  9.     File Name  : get-typeaccelerator.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requres    : Version 2, CTP3 
  12. .LINK 
  13.     Original article: 
  14.     http://www.nivot.org/2008/12/25/ListOfTypeAcceleratorsForPowerShellCTP3.aspx 
  15.     Script Repository 
  16.     http://www.pshscripts.blogspot.com 
  17. .EXAMPLE 
  18. PS C:\foo> .\get-typeaccelerators.ps1 
  19.  
  20. Name            Type 
  21. ----            ---- 
  22. adsi            System.DirectoryServices.DirectoryEntry 
  23. adsisearcher    System.DirectoryServices.DirectorySearcher 
  24. array           System.Array 
  25. bool            System.Boolean 
  26. byte            System.Byte 
  27. char            System.Char 
  28. decimal         System.Decimal 
  29. double          System.Double 
  30. float           System.Single 
  31. hashtable       System.Collections.Hashtable 
  32. int             System.Int32 
  33. ipaddress       System.Net.IPAddress 
  34. long            System.Int64 
  35. powershell      System.Management.Automation.PowerShell 
  36. pscustomobject  System.Management.Automation.PSObject 
  37. psmoduleinfo    System.Management.Automation.PSModuleInfo 
  38. psobject        System.Management.Automation.PSObject 
  39. ref             System.Management.Automation.PSReference 
  40. regex           System.Text.RegularExpressions.Regex 
  41. runspace        System.Management.Automation.Runspaces.Runspace 
  42. runspacefactory System.Management.Automation.Runspaces.RunspaceFactory 
  43. scriptblock     System.Management.Automation.ScriptBlock 
  44. single          System.Single 
  45. string          System.String 
  46. switch          System.Management.Automation.SwitchParameter 
  47. type            System.Type 
  48. wmi             System.Management.ManagementObject 
  49. wmiclass        System.Management.ManagementClass 
  50. wmisearcher     System.Management.ManagementObjectSearcher 
  51. xml             System.Xml.XmlDocument 
  52. .EXAMPLE 
  53. PS C:\foo> Get-Help .\get-typeaccelerators.ps1 -full 
  54. Left as an exercise for the reader. 
  55.  
  56. #> 
  57.  
  58. ### 
  59. #   Start of script 
  60. ### 
  61.  
  62.  
  63. ([type]::gettype("System.Management.Automation.TypeAccelerators"))::Get.getenumerator() |   
  64.     select @{Name="Name"; expression={$_.key}},   
  65.            @{name="Type"; expression={$_.value}} | sort name | format-table -autosize 
  66. # End of script 
Filed under: ,
This script uses soem cool CTP3 features to print out the currently implemented type accelearators and what they point to. NB: You can add type accelerators (a subject for a separate post!)
Copyright 2012 PowerShell.com. All rights reserved.