{"id":17652,"date":"2007-06-23T12:04:50","date_gmt":"2007-06-23T20:04:50","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17652"},"modified":"2019-05-16T12:07:55","modified_gmt":"2019-05-16T20:07:55","slug":"powershell-community-extensions-pscx-v1-1-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/powershell-community-extensions-pscx-v1-1-1\/","title":{"rendered":"PowerShell Community Extensions (PSCX) V1.1.1"},"content":{"rendered":"<p>Keith Hill reports in his blog HERE , that the PowerShell Community Extensions project has release Version 1.1.1.\nIf you aren&#8217;t already turned on to PSCX, this is a good time to start. This is a maintenance release which resolves 30 issues but it also adds 5 new features. I&#8217;m going to include their Help topic below so you can get a feel for what it does. I think most people will find something there that will tempt them.\nOne thing to note, when you dot-source PSCX&#8217;s profile, it customizes your environment to a pretty extensive degree. If you already have some customizations that you like (like your own prompt), they get overridden. As such, you might want to start out by editing the profile file and running each line by itself and checking its effects and then just comment out those sections that you don&#8217;t want.\nHere is another trick you might want to try:\nPS> SET-PSDebug -step\nPS> . $env:pscxhome:\\profile\\profile.ps1\nContinue with this operation?\n1+ <<<< . $env:pscxhome\\profile\\profile.ps1\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):\nDEBUG: 1+ <<<< . $env:pscxhome\\profile\\profile.ps1\n\nContinue with this operation?\n20+ $MaximumHistoryCount = <<<< 512\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):\nAt any given point you can SUSPEND which drops you into a nested prompt and you can explore the system up to that point. When you exit, you continue running the script. This is a pretty useful technique to be aware of.\nEnjoy!\n<Update - Some people have indicated that they would prefer this sort of content to be included as an attachment instead of in-line.  I'd like to hear what other people think - I can just as easily make things like this attachments in the future.  jps>\nJeffrey Snover [MSFT]\nWindows Management Partner Architect\nVisit the Windows PowerShell Team blog at: http:\/\/blogs.msdn.com\/PowerShell\nVisit the Windows PowerShell ScriptCenter at: http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\nTOPIC\nPowerShell Community Extensions (version 1.1.1.0)<\/p>\n<p>SHORT DESCRIPTION\nDescribes the Windows PowerShell Community Extensions (PSCX) snapin and \nhow to use the contained cmdlets and scripts that ship with PSCX.<\/p>\n<p>LONG DESCRIPTION\nPowerShell Community Extensions is a PowerShell Snapin that provides a\nnumber of widely useful cmdlets. PSCX is not affiliated with Microsoft \nor the Windows PowerShell team at Microsoft. We are a few (at the moment)\npassionate PowerShell users who wanted more cmdlets than Microsoft was \nable to deliver in v1.0. So we have taken it upon ourselves to create \nsome of those cmdlets and make them available to the community.<\/p>\n<p>PROFILE\nPSCX comes with a basic profile script that you can easily install\nand use. If you didn&#8217;t install it during PSCX installation, just copy \nthe follow PowerShell command to the prompt and execute it. However if\nyou already have a Profile.ps1 script, be sure to rename it or back it\nup first.<\/p>\n<p>Copy-Item $env:PscxHome\\Profile\\Profile.ps1 (Split-Path $Profile -Parent)<\/p>\n<p>This profile script dot sources a number of function and filter scripts \nthat provide a more sophisticated prompt, CD function as well as number of\nuseful functions like a TabExpansion function that auto-completes\non .NET namespaces and type names filters and filters like \nGet-TypeName (gtn) and Get-PropertyValue (gpv).<\/p>\n<p>To examine and\/or customize the PSCX profile just execute &#8220;Edit-Profile&#8221;\nor the alias &#8220;ep&#8221; at the PowerShell prompt.<\/p>\n<p>If you choose to use the PSCX profile then the following &#8220;PROFILE&#8221; \nfeatures will be available in your PowerShell environment.<\/p>\n<p>PREFERENCE VARIABLES\nThe following preference variables allow you to customize the behavior\nof certain PSCX functions and cmdlets. These are defined or present\nbut commented out at the top of the PSCX provide profile.<\/p>\n<p>$PscxDirForcePreference\nDir function always specifies -Force. Will cause hidden and system \nfile system items to be returned.\n$PscxDirHideSystemPreference\nDir function filters out files with the system attribute set. The \nperformance may suffer on high latency networks or in folders with \nmany files. \n$PscxFileSizeInUnitsPreference\nDisplay file sizes in KB, MB, GB multiples. \n$PscxSmtpFromPreference\nNot defined by default. Set to something like &#8220;j_doe@some.domain.com&#8221;\nand you will not need to specify the corresponding parameter on the\nSend-SmtpMail cmdlet.\n$PscxSmtpHostPreference\nNot defined by default. Set to something like &#8220;smtp.some.domain.com&#8221;\nand you will not need to specify the corresponding parameter on the\nSend-SmtpMail cmdlet.\n$PscxSmtpPortPreference\nNot defined by default. Set to something like 587 if you SMTP server\ndoesn&#8217;t use the default port (25) and you will not need to specify \nthe corresponding parameter on the Send-SmtpMail cmdlet.\n$PscxTextEditorPreference\nDefines which editor is started by the EditFile function (alias &#8220;e&#8221;).\nDefaulted to &#8220;Notepad&#8221;. Change to your favorite text editor.\n$PscxTranscribeSessionPreference\nSet to true to create a transcript of the entire PowerShell session.<\/p>\n<p>CMDLETS\nTo see what cmdlets are provided by PSCX, execute the alias &#8220;gcmpscx&#8221; at\nthe PowerShell prompt. The current PSCX cmdlets are listed below:<\/p>\n<p>Get-ADObject\nSearch for objects in the Active Directory\/Global Catalog. <\/p>\n<p>Resolve-Assembly\nResolve and optionally import Assemblies by partial name with optional \nVersion. <\/p>\n<p>Test-Assembly\nTests whether or not the specified file is a .NET assembly. <\/p>\n<p>ConvertFrom-Base64\nConverts base64 encoded string to byte array. <\/p>\n<p>ConvertTo-Base64\nConverts byte array or specified file contents to base64 string. By \ndefault, this cmdlet inserts line breaks every 76 characters and outputs \nthe result in a single string. For very large files, you may run into \nOutOfMemoryExceptions. In this case, use the -Stream parameter which will \ngenerate multiple string outputs that, combined together, result in the \nequivalent base 64 text. <\/p>\n<p>Export-Bitmap\nExports a bitmap object to a specified file format. <\/p>\n<p>Import-Bitmap\nLoads bitmap files. <\/p>\n<p>Resize-Bitmap\nResizes bitmaps. <\/p>\n<p>Format-Byte\nTurns numbers into nicely formatted byte count, using the highest \npossible unit. <\/p>\n<p>Write-BZip2\nCreate BZIP2 format archive files from pipline or parameter input. <\/p>\n<p>Get-Clipboard\nGets data from the clipboard. <\/p>\n<p>Out-Clipboard\nFormats text via Out-String before placing in clipboard. <\/p>\n<p>Set-Clipboard\nPuts the specified object into the system clipboard. <\/p>\n<p>Write-Clipboard\nWrites objects to the clipboard using their string representation, \nbypassing the default PowerShell formatting. <\/p>\n<p>Get-DhcpServer\nThe Get-DhcpServer cmdlet gets all authorized DHCP server from the Active \nDirectory Forest. <\/p>\n<p>Get-DomainController\nGets a list of available domain controller in the current forest\/domain. <\/p>\n<p>Get-ExportedType\nDisplays public types for a given AssemblyName by loading the associated \nassembly into a reflection-only context and dumping all publicly \naccessible Type objects to the pipeline. This cmdlet is typically used in \nconjunction with AssemblyName objects returned from the GAC provider to \ndisplay potential candidates for the New-Object cmdlet. Dependent \nassemblies are not automatically resolved by default as the primary \nassembly is loaded into a specialized &#8220;reflection-only&#8221; context; this \naids with debugging versioning and\/or dependency issues. Providing the \nResolveDependencies SwitchParameter will cause the cmdlet to try to load \ndependent assemblies automatically; if not present, you will be prompted \nto load them. See notes at footer for more information. <\/p>\n<p>Set-FileTime\nSets a file or folder&#8217;s created and last accessed\/write times. <\/p>\n<p>Get-FileVersionInfo\nAttempts to get the FileVersionInfo object for the specified path. \nUsually only executable files include file version information. <\/p>\n<p>Get-ForegroundWindow\nReturns the hWnd or handle of the window in the foreground on the current \ndesktop. See also Set-ForegroundWindow. <\/p>\n<p>Set-ForegroundWindow\nGiven an hWnd or window handle, brings that window to the foreground. \nUseful for restoring a window to uppermost after an application which \nseizes the foreground is invoked. See also Get-ForegroundWindow <\/p>\n<p>Write-GZip\nCreate GNU ZIP (GZIP) format files from pipeline or parameter input. <\/p>\n<p>New-Hardlink\nCreates filesystem hard links. The hardlink and the target must reside on \nthe same NTFS volume. <\/p>\n<p>Get-Hash\nGets the hash value for the specified file or byte array via the \npipeline. The default hash algorithm is MD5, although you can specify \nother algorithms using the -Algorithm parameter (MD5, SHA1, SHA256, \nSHA384, SHA512 and RIPEMD160). This cmdlet emits a HashInfo object that \nhas properties for Path, Algorithm, HashString and Hash. <\/p>\n<p>Format-Hex\nThe Format-Hex command displays the contents of the specified files in \nhex format. This cmdlet will also accept pipeline input in the form of a \nbyte stream. The output can be controlled via various parameters to \nindicate the number of columns that should be displayed or alternatively \nyou can specify the width of the output. The header, address and ASCII \nportions of the display can also be turned off individually. The offset \nand count can also be specified via parameters to control where in the \ninput to start displaying and how much to display. <\/p>\n<p>Ping-Host\nSends ICMP echo requests to network hosts. <\/p>\n<p>Resolve-Host\nResolves host names to IP addresses. <\/p>\n<p>New-Junction\nCreates NTFS directory junctions. <\/p>\n<p>ConvertTo-MacOs9LineEnding\nConverts the line endings in the specified file to Mac OS9 and earlier \nstyle line endings &#8220;\\r&#8221;. You can convert a single file to a new file \nname. Or you can convert multiple files and specify a destination \ndirectory. By default, this cmdlet will overwrite existing files unless \nyou specify -NoClobber. If you want to force the overwrite of read only \nfiles use the -Force option. <\/p>\n<p>Get-MountPoint\nReturns all mount points defined for a specific root path. <\/p>\n<p>Remove-MountPoint\nRemoves a mount point, dismounting the current media if any. If used \nagainst the root of a fixed drive, removes the drive letter assignment. <\/p>\n<p>Get-PEHeader\nThe PE header for Windows executables includes various useful bits of \ninformation including the image base address, subsystem, linker version, \netc. <\/p>\n<p>Get-Privilege\nLists privileges held by the session and their current status. <\/p>\n<p>Set-Privilege\nAdjusts privileges held by the session. <\/p>\n<p>Start-Process\nStarts a new process. This cmdlet can be used with documents to invoke \ntheir default verb or the verb can be specified using the -Verb \nparameter. You can also specify the -Credential parameter to run the \nprocess as a different user. <\/p>\n<p>Get-PSSnapinHelp\nGenerates a XML file containing all documentation data. <\/p>\n<p>Get-Random\nReturns a random integer in a specified interval, a double-precision \nnumber between 0 and 1, or a buffer of random bytes. It may use the \ncryptographically strong random number generator, if desired. <\/p>\n<p>Get-ReparsePoint\nGets NTFS reparse point data. <\/p>\n<p>Remove-ReparsePoint\nRemoves NTFS reparse junctions and symbolic links. <\/p>\n<p>New-Shortcut\nCreates shell shortcuts. <\/p>\n<p>Get-ShortPath\nGets the short, 8.3 name for the given path. This cmdlet emits a \nShortPathInfo object that contains a ShortPath property as well as a Path \nproperty which contains the original long path. <\/p>\n<p>Send-SmtpMail\nSends email via specified SMTP server to specified recipients. This \ncmdlet checks for existence of several preference that if set can make \nthis cmdlet much easier to use. Those preference variables are: * \n$PscxSmtpHostPreference=&#8221;smtp.example.net&#8221; * $PscxSmtpPortPreference=587 \n* $PscxSmtpFromPreference=&#8221;john_doe@example.net&#8221; <\/p>\n<p>Join-String\nJoins an array of strings into a single string. <\/p>\n<p>Split-String\nSplits a single string into an array of strings. <\/p>\n<p>New-Symlink\nCreates filesystem symbolic links. Requires Microsoft Windows Vista or \nlater. <\/p>\n<p>Get-TabExpansion\nThis command provides access to the PSCX tab expansion engine. If you are \nnot using the PSCX profile, call this command from your TabExpansion \nfunction. <\/p>\n<p>Start-TabExpansion\nInitializes the caches used by Get-TabExpansion. These may include the \n.NET namespace and type cache, the WMI class cache, and more. <\/p>\n<p>Write-Tar\nCreate Tape Archive (TAR) format files from pipeline or parameter input. <\/p>\n<p>Disconnect-TerminalSession\nDisconnects a specific remote desktop session on a system running \nTerminal Services\/Remote Desktop <\/p>\n<p>Get-TerminalSession\nGets information on terminal services sessions. <\/p>\n<p>Stop-TerminalSession\nLogs off a specific remote desktop session on a system running Terminal \nServices\/Remote Desktop <\/p>\n<p>ConvertTo-UnixLineEnding\nConverts the line endings in the specified file to Unix line endings \n&#8220;\\n&#8221;. You can convert a single file to a new file name. Or you can \nconvert multiple files and specify a destination directory. By default, \nthis cmdlet will overwrite existing files unless you specify -NoClobber. \nIf you want to force the overwrite of read only files use the -Force \noption. <\/p>\n<p>Set-VolumeLabel\nModifies the label shown in Windows Explorer for a particular disk \nvolume. <\/p>\n<p>ConvertTo-WindowsLineEnding\nConverts the line endings in the specified file to Windows line endings \n&#8220;\\r\\n&#8221;. You can convert a single file to a new file name. Or you can \nconvert multiple files and specify a destination directory. By default, \nthis cmdlet will overwrite existing files unless you specify -NoClobber. \nIf you want to force the overwrite of read only files use the -Force \noption. <\/p>\n<p>Convert-Xml\nPerforms XSLT transforms on the specified XML file or XmlDocument. Use \nthe EnableScript parameter to enable script embedded in the XSLT file. <\/p>\n<p>Format-Xml\nPretty print for XML files and XmlDocument objects. <\/p>\n<p>Select-Xml\nSelect-Xml provides an easy way to define namespace prefix to namespace \nmappings. It handles creating a NamespaceManager and associating that \nwith the XPath queries executed against the supplied XML. <\/p>\n<p>Test-Xml\nTests for well formedness and optionally validates against XML Schema. It \ndoesn&#8217;t handle specifying the targetNamespace. To see validation error \nmessages, specify the -Verbose flag. <\/p>\n<p>Write-Zip\nCreate ZIP format archive files from pipline or parameter input. <\/p>\n<p>PROVIDERS\nAssemblyCache\nProvides access to the .NET Global Assembly Cache and the assemblies it \ncontains. The assemblies are exposed as AssemblyName objects. <\/p>\n<p>DirectoryServices\nProvides access to LDAP servers like Active Directory or AD Lightweight \nDirectory Services. <\/p>\n<p>FeedStore\nProvides access to the Internet Explorer 7 RSS feed store. <\/p>\n<p>FILTERS\nGet-PropertyValue\nThis filter is different from the Select-Object cmdlet in that it doesn&#8217;t \ncreate a wrapper object (PSCustomObject) around the property. If you just \nwant to get the property&#8217;s value to assign it to another variable this \nfilter will come in handy. If you assigned the result of the \nSelect-Object operation you wouldn&#8217;t get the property&#8217;s value. You would \nget an object that wraps that property and its value. <\/p>\n<p>Usage:\n$start = Get-History -Id 143 | Get-PropertyValue StartExecutionTime<\/p>\n<p>Invoke-NullCoalescing\nSimilar to the C# ?? operator e.g. name = value ?? String.Empty; where \nvalue would be a Nullable<T> in C#. Even though PowerShell doesn&#8217;t \nsupport nullables yet we can approximate this behavior. In the example \nbelow, $LogDir will be assigned the value of $env:LogDir if it exists and \nit&#8217;s not null, otherwise it get&#8217;s assigned the result of the second \nscript block (C:\\Windows\\System32\\LogFiles). This behavior is also \nanalogous to Korn shell assignments of this form: LogDir = \n${$LogDir:-$WinDir\/System32\/LogFiles} <\/p>\n<p>Usage:\n$LogDir = ?? {$env:LogDir} {&#8220;$env:windir\\System32\\LogFiles&#8221;}<\/p>\n<p>Invoke-Ternary\nSimilar to the C# ? : operator e.g. name = (value != null) ? String.Empty \n: value; <\/p>\n<p>Usage:\n1..10 | ?: {$_ -gt 5} {&#8220;Greater than 5&#8221;;$_} {&#8220;Not greater than 5&#8221;;$_}<\/p>\n<p>New-HashObject\nUse when you need to create a PSObject from a dictionary. The keys-value \npairs are turned into NoteProperties. <\/p>\n<p>Usage:\n$ht = @{fname=&#8217;John&#8217;;lname=&#8217;Doe&#8217;;age=42}\n$ht | New-HashObject<\/p>\n<p>Remove-Accessors\nThis filter is intended to be used to filter the Get-Member output to \neliminate display of compiler generated accessor methods. <\/p>\n<p>Usage:\nGet-Process | Get-Member | Remove-Accessors<\/p>\n<p>FUNCTIONS\nAdd-PathVariable\nThis function adds the specified paths to the specified environment \nvariable. <\/p>\n<p>Usage:\nAdd-PathVariable Path C:\\Bin,C:\\Users\\John\\Bin<\/p>\n<p>cd\nCD function that handles location history via a backward and forward \nstack mechanism that can be navigated using &#8220;cd -&#8221; to go backwards in the \nstack and &#8220;cd +&#8221; to go forwards in the stack. Executing &#8220;cd&#8221; without any \nparameters will display the current stack history. For more information \nexecute &#8220;cd -?&#8221;. <\/p>\n<p>Usage:\ncd $pscxhome; cd -; cd +; cd -0<\/p>\n<p>cd-\nAuto-correct function for &#8216;cd -&#8216; which changes location backwards in the \nstack. <\/p>\n<p>cd..\nAuto-correct function for &#8216;cd ..&#8217; which changes location up one level. <\/p>\n<p>cd&#8230;\nAuto-correct function for &#8216;cd &#8230;&#8217; which changes location up two levels. <\/p>\n<p>cd&#8230;.\nAuto-correct function for &#8216;cd &#8230;.&#8217; which changes location up three \nlevels. <\/p>\n<p>cd&#8230;..\nAuto-correct function for &#8216;cd &#8230;..&#8217; which changes location up four \nlevels. <\/p>\n<p>cd?\nAuto-correct function for &#8216;cd ?&#8217; which displays usage information. <\/p>\n<p>cd\\\nAuto-correct function for &#8216;cd \\&#8217; which changes location to the root of \nthe current drive. <\/p>\n<p>cd~\nAuto-correct function for &#8216;cd ~&#8217; which changes location to your Home dir. <\/p>\n<p>cd+\nAuto-correct function for &#8216;cd +&#8217; which changes location forwards in the \nstack. <\/p>\n<p>Collect\nSimple alias for the [System.GC]::Collect() static method. This comes in \nhandy when a .NET object hasn&#8217;t been disposed and is causing a file \nsystem handle to not be released. <\/p>\n<p>Usage:\ncollect<\/p>\n<p>dird\nDisplays just containers (directories). <\/p>\n<p>Usage:\ndird\ndird -first 5\ndird C:\\,$env:windir -combine<\/p>\n<p>dirs\nDisplays folder contents sorted by size descending. <\/p>\n<p>Usage:\ndirs\ndirs -first 10\ndirs C:\\,$Home -combine -f 20<\/p>\n<p>dirt\nDisplays folder contents sorted by time descending. <\/p>\n<p>Usage:\ndirt\ndirt -first 10\ndirt C:\\,$Home -combine -last 20<\/p>\n<p>dirw\nDisplays folder contents in wide format. <\/p>\n<p>Usage:\ndirw\ndirw C:\\,$env:windir -combine<\/p>\n<p>dirx\nDIRX is an extended dir function that is used by dird, dirs and dirt. It \nprovides shortcuts for displaying files\/dirs with particular attributes. \nFor more information execute &#8220;dirx -?&#8221;. <\/p>\n<p>Usage:\ndirx\ndirx -set Directory,Hidden<\/p>\n<p>Disable-Breakpoints\nGlobally disables breakpoints. <\/p>\n<p>Edit-File\nOpens up the specified text file in the text editor specified by \n$PscxTextEditorPreference variable. If not specified or the specified \neditor isn&#8217;t found then notepad is used. <\/p>\n<p>Usage:\nEdit-File foo.txt\ngci -r -filter *.make | edit-file<\/p>\n<p>Edit-GlobalHostProfile\nOpens the machine wide, host specific profile into the editor defined by \n$PscxTextEditorPreference variable. If not specified or the specified \neditor isn&#8217;t found then notepad is used. <\/p>\n<p>Edit-GlobalProfile\nOpens the machine wide generic (non-host specific) profile into the \neditor defined by $PscxTextEditorPreference variable. If not specified or \nthe specified editor isn&#8217;t found then notepad is used. <\/p>\n<p>Edit-HostProfile\nOpens the user&#8217;s host specific profile into the editor defined by \n$PscxTextEditorPreference variable. If not specified or the specified \neditor isn&#8217;t found then notepad is used. <\/p>\n<p>Edit-Profile\nOpens the user&#8217;s generic (non-host specific) profile into the editor \ndefined by $PscxTextEditorPreference variable. If not specified or the \nspecified editor isn&#8217;t found then notepad is used. <\/p>\n<p>Elevate\nRuns the specified command via an elevated PowerShell instance on Vista. \nTo get debug info, set $DebugPreference temporarily to &#8216;Continue&#8217;. <\/p>\n<p>Usage:\nelevate\nelevate notepad c:\\windows\\system32\\drivers\\etc\\hosts\nelevate gci c:\\windows\\temp\nelevate {gci c:\\windows\\temp | export-clixml tempdir.xml; exit}\nelevate {gci c:\\windows\\temp | export-clixml tempdir.xml; exit} | \n%{$_.WaitForExit(5000)} | %{Import-Clixml tempdir.xml}<\/p>\n<p>Enable-Breakpoints\nGlobally enables breakpoints. <\/p>\n<p>Get-CallStack\nDisplays the function invocation callstack. <\/p>\n<p>Get-ExceptionForHR\nReturns an exception object for a HRESULT code. <\/p>\n<p>Usage:\nhrexc -2147023293\nFatal error during installation. (Exception from HRESULT: 0x80070643)<\/p>\n<p>Get-ExceptionForWin32\nReturns an exception object for a windows error code. <\/p>\n<p>Usage:\nwinexc 5\nAccess is denied<\/p>\n<p>Get-PscxAlias\nDisplays all of the aliases created by PSCX. <\/p>\n<p>Get-PscxCmdlet\nDisplays all of the cmdlets provided by PSCX. <\/p>\n<p>Get-PscxDrive\nDisplays all of the drives created by PSCX. <\/p>\n<p>Get-PscxVariable\nDisplays the variables defined by PSCX. <\/p>\n<p>Get-TabExpansion\nTabExpansion enhances the built-in tab expansion feature of PowerShell. \nThis function does nothing more than call the PSCX cmdlet \nGet-TabExpansion. NOTE: This function is invoked by PowerShell. You \nshouldn&#8217;t need to invoke it directly. <\/p>\n<p>Usage:\nPlace the following command in your profile if it isn&#8217;t present:\n. &#8220;$Env:PscxHome\\Profile\\TabExpansion.ps1&#8221;<\/p>\n<p>Get-VariableSorted\nBehaves just like Get-Variable except that the output is sorted by name. <\/p>\n<p>glp\nGets the current location&#8217;s path. This is handy if you just want to see \nwhat your location is in a very terse format. <\/p>\n<p>Less\nProvides easy PowerShell access to the external Less-394 paging \napplication. NOTE: Be careful using less with large amounts of output \ne.g. gci $env:windir\\System32 | less. It appears that PowerShell buffers \nup all the gci output before converting it to strings to pass to less. <\/p>\n<p>Usage:\nGet-Content foo.txt | less<\/p>\n<p>Prompt\nReplacement prompt function. See $PscxHome\\Profile\\EyeCandy.Jachym.ps1 \nand $PscxHome\\EyeCandy.Keith.ps1 for examples on how to configure the \nprompt function. Or just comment out the dot sourced EyeCandy scripts in \n$UserProfile if you have your own prompt function. <\/p>\n<p>Quote-List\nUse as a wrist friendly way of creating an array of strings without \nhaving to type extraneous commas and quotes: <\/p>\n<p>Usage:\nql foo bar baz # equivalent of &#8220;foo&#8221;, &#8220;bar&#8221;, &#8220;baz&#8221;<\/p>\n<p>Quote-String\nUse as a wrist friendly way of create a string from a set of items where \neach item will be separated by $OFS. Eliminates having to type extraneous \nquotes: <\/p>\n<p>Usage:\nqs $a $b $c # equivalent of &#8220;$a $b $c&#8221;<\/p>\n<p>Set-Breakpoint\nThis function sets a breakpoint in a script that causes a nested prompt \nto be entered. <\/p>\n<p>Usage:\nSet-Breakpoint<\/p>\n<p>Skip-Breakpoints\nSkips over specified number of breakpoints before breaking. <\/p>\n<p>Usage:\nSkip-Breakpoints 5<\/p>\n<p>Update-Profile\nReloads the user&#8217;s generic (non-host specific) profile. <\/p>\n<p>SCRIPTS\nAdd-DirectoryLength\nCalculates the sizes of the specified directory and adds that size as a \n&#8220;Length&#8221; NoteProperty to the input DirectoryInfo object. This script is \npipeline oriented. <\/p>\n<p>Usage:\nGet-ChildItem . -recurse | Add-DirectoryLength | sort Length<\/p>\n<p>Add-ShortPath\nAdds the file or directory&#8217;s short path as a &#8220;ShortPath&#8221; NoteProperty to \nthe input DirectoryInfo object. NOTE: This filter requires the PSCX \ncmdlet Get-ShortPath <\/p>\n<p>Usage:\ndir | Add-ShortPath | Format-Table ShortPath,FullName<\/p>\n<p>Clip\nThis function enables quick access to the text data in the clipboard. <\/p>\n<p>Usage:\ndir | clip\nclip | ConvertTo-WindowsLineEnding | sc D:\\Mary\\file.txt<\/p>\n<p>Connect-VirtualServer\nInvokes URL to Virtual Server&#8217;s VSWebApp.exe. <\/p>\n<p>ConvertFrom-WmiDateTime\nUses the PowerShell ManagementDateTimeConverter to converter between WMI \nand .NET DateTime. This is a pipeline oriented script. <\/p>\n<p>Usage:\ngwmi win32_operatingsystem | gpv LastBootUpTime | ConvertFrom-WmiDateTime<\/p>\n<p>ConvertFrom-WmiTimeSpan\nUses the PowerShell ManagementDateTimeConverter to converter between WMI \nand .NET TimeSpan. This is a pipeline oriented script. <\/p>\n<p>ConvertTo-DmtfDateTime\nUses the PowerShell ManagementDateTimeConverter to converter between DMTF \nand .NET DateTime. <\/p>\n<p>ConvertTo-DmtfTimeInterval\nUses the PowerShell ManagementDateTimeConverter to converter between DMTF \nand .NET TimeSpan. <\/p>\n<p>Export-History\nExports your entire command history to a clixml file. <\/p>\n<p>Usage:\nExport-History\nExport-History $home\\hist.xml<\/p>\n<p>Get-DiskUsage\nGets the disk info (free,used,etc) for each drive. <\/p>\n<p>Get-HelpMatch\nSearch the PowerShell help documentation for a given keyword or regular \nexpression. <\/p>\n<p>Usage:\nGet-HelpMatch hashtable\nGet-HelpMatch &#8220;(datetime|ticks)&#8221; -verbose<\/p>\n<p>Get-LoremIpsum\nLorem ipsum generator. <\/p>\n<p>Usage:\nGet-LoremIpsum\nGet-LoremIpsum 20 -Language Spanish<\/p>\n<p>Get-PagedHelp\nPages help using LESS. <\/p>\n<p>Get-ScreenCss\nGenerate CSS header for HTML &#8220;screen shot&#8221; of the host buffer. <\/p>\n<p>Usage:\n$css = Get-ScreenCss<\/p>\n<p>Get-ScreenHtml\nFunctions to generate HTML &#8220;screen shot&#8221; of the host buffer. <\/p>\n<p>Usage:\nGet-ScreenHtml\nGet-ScreenHtml 25<\/p>\n<p>Get-TypeName\nThis filter is handy for finding out what types are being passed down the \npipeline quickly. Normally you would use Get-Member to determine this but \nif you are only interested in the type name this filter produces much \nless output. Also, since Get-Member accumulates multiple instances of the \nsame type into a single output record for that type, you don&#8217;t get any \nsense of how many objects of that type are traversing the pipeline. With \nthis filter, you will see the type name of *every* object passed into it. \nNOTE: If you specify any arguments then all pipeline input is ignored. \nThis is due to the fact that PowerShell executes the Process function \neven if there isn&#8217;t any input so it is impossible to distinguish between \n$null pipeline input and no pipeline input. <\/p>\n<p>Usage:\ngcm get-* | Get-TypeName\nGet-TypeName &#8220;hi&#8221; 1 3.14 $false\nGet-Command get-* | Get-TypeName -FullName<\/p>\n<p>Get-Url\nThis script scrapes the web page of the supplied web URL and outputs a \nstring containing the contents of the web page. <\/p>\n<p>Usage:\nGet-Url http:\/\/www.codeplex.com\/PowerShellCX\/Project\/ProjectRss.aspx<\/p>\n<p>Get-ViewDefinition\nGets the possible alternate views for the specified object. <\/p>\n<p>Usage:\nGet-ViewDefinition\nGet-ViewDefinition System.Diagnostics.Process\nGet-ViewDefinition Pscx.Commands.HashInfo $pscxhome\\formatdata\\*.ps1xml\nGet-Process | Select -first 1 | Get-ViewDefinition | ft Name,Style -groupby SelectedBy<\/p>\n<p>Import-Assembly\nImports the specified assembly via LoadWithPartialName or LoadFrom. <\/p>\n<p>Usage:\nImport-Assembly System.Windows.Forms\nImport-Assembly .\\Foo.dll<\/p>\n<p>Import-History\nImports command history from a clixml file. <\/p>\n<p>Usage:\nImport-History\nImport-History $home\\hist.xml<\/p>\n<p>Out-Speech\nOutputs text as spoken words <\/p>\n<p>Usage:\nOut-Speech &#8220;Hello World&#8221;<\/p>\n<p>Reduce-Object\nApplies the supplied reduce function against the pipeline objects. If a \nreduce function isn&#8217;t applied the following default function is used: \n{param($1,$2) $1 + $2}. The first parameter to this function is the seed \nvalue to use send to the reduce function as the first parameter. The \nreduce function is the second parameter. <\/p>\n<p>Usage:\n1..5 | Reduce-Object 0\n1..5 | Reduce-Object 1 {param($1,$2)$1*$2}<\/p>\n<p>Resolve-Error\nUse when reporting an error or ask a question about a exception you are \nseeing. This function provides all the information we have about the \nerror message making it easier to diagnose what is actually going on. <\/p>\n<p>Search-Transcript\nSearches your session transcript files for the specified pattern. <\/p>\n<p>Usage:\nSearch-Transcript fxml<\/p>\n<p>Select-History\nSelects individual history info objects or ranges of them. <\/p>\n<p>Usage:\nSelect-History (1..5+8,9+14..20)<\/p>\n<p>Select-Random\nSelects a random element from the collection either passed as a parameter \nor input via the pipeline. <\/p>\n<p>Usage:\n$arr = 1..5; Select-Random $arr\n1..5 | Select-Random<\/p>\n<p>Set-ReadOnly\nThis filter can be used to change a file&#8217;s read only status. <\/p>\n<p>Usage:\nSet-ReadOnly foo.txt\nSet-ReadOnly [a-h]*.txt -passthru\nGet-ChildItem bar[0-9].txt | Set-ReadOnly<\/p>\n<p>Set-Writable\nThis filter can be used to change a file&#8217;s read only status. <\/p>\n<p>Usage:\nSet-Writable foo.txt\nSet-Writable [a-h]*.txt -passthru\nGet-ChildItem bar[0-9].txt | Set-Writable<\/p>\n<p>PROFILE DEFINED ALIASES\nTo see what aliases get created by PSCX, execute the alias &#8220;galpscx&#8221; at\nthe PowerShell prompt. The current PSCX defined aliases are listed below:<\/p>\n<p>: alias for <\/p>\n<p>UTILITY APPLICATIONS\nLess-394\nLess-394 is a paging utility that PSCX installs and hooks into the \nhelp and man aliases. Using Less to browse help topics is \nsignificantly nicer than the default paging in PowerShell. PSCX does\nnot however redefine PowerShell&#8217;s &#8220;more&#8221; function to use Less because \nthe way PowerShell interops with legacy applications causes all output\nto be rendered to text before it is sent to a legacy application. \nThat makes commands like the following take too much time to generate \nany output:<\/p>\n<p>PS> gci &#8216;$env:windir -rec | more&#8217; <\/p>\n<p>EchoArgs\nThis is a simple legacy console application that can be very useful \nwhen you are troubleshooting the invocation of a legacy application\nwith complex parameters. The typical problem is that you may think \nthe parameters are being passed literally to the legacy application \nwhen in fact PowerShell is parsing the parameters via its standard\nparameter parsing and then passing the result to the legacy \napplication e.g.:<\/p>\n<p>PS> echoargs a \/b -c -d:user \/e:foo.cs;405\nArg 0 is <a>\nArg 1 is <\/b>\nArg 2 is <-c>\nArg 3 is <-d:>\nArg 4 is <user>\nArg 5 is <\/e:foo.cs><\/p>\n<p>405<\/p>\n<p>Notice that PowerShell passes &#8216;-d:user&#8217; as two different \nparameters. And since &#8216;;&#8217; is the statement separator in PowerShell \nthe 405 part of the parameter &#8216;\/e:foo.cs;405&#8217; is not even considered \na parameter to the legacy application. These sort of problems are \ntypically solved by quoting the arguments to legacy applications e.g.:<\/p>\n<p>5> echoargs a \/b -c &#8216;-d:user&#8217; &#8216;\/e:foo.cs;405&#8217;\nArg 0 is <a>\nArg 1 is <\/b>\nArg 2 is <-c>\nArg 3 is <-d:user>\nArg 4 is <\/e:foo.cs;405><\/p>\n<p>MISCELLANOUS FEATURES\nAn &#8220;Open PowerShell Prompt&#8221; here Windows Explorer context menu item is\ncreated for folders and drives. A PowerShell script icon is also \nregistered for the PS1 file extension as well as a user friendly name\nfor the file type &#8211; &#8220;Windows PowerShell Script&#8221;. Note: PSCX does *not*\nchange the default verb association. PS1 files will still open in \nNotepad when they are double-clicked or invoked with the &#8220;Open&#8221; or\n&#8220;Edit&#8221; verbs.<\/p>\n<p>FEEDBACK\nPlease submit any feedback, including defects and enhancement requests, \nto either the discussions forums at:<\/p>\n<p>http:\/\/www.codeplex.com\/PowerShellCX\/Thread\/List.aspx<\/p>\n<p>or via the Issue Tracker at:<\/p>\n<p>http:\/\/www.codeplex.com\/PowerShellCX\/WorkItem\/List.aspx<\/p>\n<p>We are also interested in suggestions you may have for cmdlets. Over\ntime, we hope to be able to add some custom providers but that greatly\ndepends on recruiting some more developers for the PSCX project.<\/p>\n<p>CONTRIBUTING TO PSCX\nIf you are:<\/p>\n<p>A) A software developer with experience programming in C# \nB) Passionate about Windows PowerShell \nC) Interested in contributing your coding talents to the project, please\ndrop me an email at:<\/p>\n<p>r_keith_hill@hotmail.com.<\/p>\n<p>SEE ALSO\nFor more information, most of the cmdlets have help associated with \nthem e.g.:<\/p>\n<p>PS> help Get-Clipboard<\/p>\n<p>The definitive information on a cmdlet&#8217;s parameters can be obtained\nby executing:<\/p>\n<p>PS> Get-Command Split-String | Format-List *<\/p>\n<p>or more tersely:<\/p>\n<p>PS> gcm split-string | fl *<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Keith Hill reports in his blog HERE , that the PowerShell Community Extensions project has release Version 1.1.1. If you aren&#8217;t already turned on to PSCX, this is a good time to start. This is a maintenance release which resolves 30 issues but it also adds 5 new features. I&#8217;m going to include their Help [&hellip;]<\/p>\n","protected":false},"author":685,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17652","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Keith Hill reports in his blog HERE , that the PowerShell Community Extensions project has release Version 1.1.1. If you aren&#8217;t already turned on to PSCX, this is a good time to start. This is a maintenance release which resolves 30 issues but it also adds 5 new features. I&#8217;m going to include their Help [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/685"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17652"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17652\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}