This PowerShell module is aimed at providing a widely useful set of additional cmdlets, providers, aliases, filters, functions and scripts for PowerShell Core that members of the community have expressed interest in.
This repository is a fork of the official PowerShell Community Extensions hosted and maintained at GitHub. The fork has been made from version 4.0.0-beta4 (commit 6980fdf0).
The customizations made in this fork include:
See Changelog.md for more detailed information.
PSCX is licensed under MIT license. This work includes other open-source projects licensed under their respective licenses, attached as appropriate. See the PSCX LICENSE file as well Imports folder for respective license files of the projects distributed/leveraged.
Pscx-{version}.zip
file - this is an artifact of GitHub. A solution/work-around may surface, but for the time being this is not seen as a major inconvenience.Pscx-{version}.zip
file to ~/Documents/PowerShell/Modules
folderimport-module pscx
Required Annotations:
Cmdlet
using appropriate PscxVerbs and PscxNouns per the containing module. Do not use plain strings as this interferes with the tooling (see below)Description
specify a summary of what the cmdlet accomplishes. This supports the tooling as well.DetailedDescription
for more detailed information. While the format is not as flexible as the documentation comments in a ps1
file, it is in keeping of the best practice of having documentation as close to the code as possible, for contextual/sustaining benefitsPlace a new C# cmdlet in the OS appropriate project - Pscx
for cross-platform, Pscx.Win
for Windows specific. Pscx.Core
is a framework level library that both Pscx
and Pscx.Win
projects depend upon; it is not intended to contain exportable cmdlets but their base classes and utilities.
When this OS based functionality separation is not self evident and a class is not entirely cross-platform nor OS specific, at a minimum do annotate the functions that are OS specific with SupportedOSPlatform
attribute. Refactoring the design where the OS specific classes extend a basic common functionality is encouraged.
When new C# cmdlets are added, remember to add corresponding help file in Pscx.Help
project.
Several conveniences are made available in support of release process:
Tools\version_update.ps1
- consistently updates the version across all assembly info classes, psd1 files, etc.Tools\find_cmdlets.ps1
- reports all the cmdlets and functions found throughout the PSCX solution (all projects and modules) (based on the Cmdlet annotations discussed above). This aids in creating the psd1
module files. It also helps with creating the content of the Cmdlets and Functions sections below - it pulls the cmdlet name and description (non-MD formatted, but it could be) such that it can be pasted directly into the section and apply MD formatting.
Export-ModuleMember
statements to explicitly list functions exported from that module. The parent module must include all the functions exported by the child/nested modules (leverage Import-Module -PassThru
to get a module object and loop through ExportedFunctions
property)Cmdlets and functions below are sorted by noun. As always, you can get full Powershell help including examples using get-help [command]
Sets a file or folder's created and last accessed/write times.
Edit file with configured editor - VSCode, Notepad++/TextMate, default for OS
Tests whether or not the specified file is a .NET assembly.
Get the current environment block
Converts base64 encoded string to byte array.
Tests for well formedness and optionally validates against XML Schema.
Converts the line endings in the specified file to Windows line endings \"\r\n\".
Converts XML through a XSL
Get type name as conveniently detailed information
Gets the specified path-like environment variable, defaults to PATH
Generates a lorem-ipsum text of specified length
Skips an object - similar with LINQ Skip() method, allows the user to skip the first N and/or last N objects in a sequence
Get the Portable Executable file header
Gets the hash value for the specified file or byte array via the pipeline.
Converts a measurement from one unit into another (compatible) unit.
Converts the line endings in the specified file to Unix line endings \"\n\".
Given an hWnd or window handle, brings that window to the foreground. Useful for restoring a window to uppermost after an application which seizes the foreground is invoked. See also Get-ForegroundWindow
Returns the hWnd or handle of the window in the foreground on the current desktop. See also Set-ForegroundWindow.
Test script for validity
Get drive information
Pretty print for XML files and XmlDocument objects.
Pushes the current environment frame onto stack
Get the file version information
Pops the environment block frame from the stack
Converts the line endings in the specified file to Mac OS9 and earlier style line endings \"\r\".
Format the byte sizes in human readable forms - progressively increasing the unit based on byte size value
Tails the contents of a file - optionally waiting on new content.
Converts byte array to base64 string.
Splits a single string into an array of strings.
Adds values to an environment variable of type PATH (default is PATH variable)
Sets/overrides a path-like variable (defaults to PATH) to the value specified
Displays contents of files for byte streams in hex.
Joins an array of strings into a single string.
Returns all mount points defined for a specific root path.
Get ADO data provider
Adjusts privileges held by the session.
Query and retrieve SQL data set
Lists Optical drive information
Disconnects a specific remote desktop session on a system running Terminal Services/Remote Desktop
Invokes sql commands on Sql Server database
Removes NTFS reparse junctions and symbolic links.
Creates Archives using 7zip library - supports all types 7zip does
Creates NTFS directory junctions.
Lists privileges held by the session and their current status.
Creates filesystem hard links. The hardlink and the target must reside on the same NTFS volume.
Gets NTFS reparse point data.
Finds the domain controller
Modifies the label shown in Windows Explorer for a particular disk volume.
Get the amount of time the system was up
Check group membership for the requested user identity
Retrieves currently running COM object
Invokes an ADO command
Removes a mount point, dismounting the current media if any. If used against the root of a fixed drive, removes the drive letter assignment.
Search for objects in the Active Directory/Global Catalog.
Get the terminal session
Gets the short, 8.3 name for the given path.
List the contents of an archive - all types supported by 7zip
Logs off a specific remote desktop session on a system running Terminal Services/Remote Desktop
Retrieve data set through an OLE-DB connection
Get an ADO connection
Extract Archives using 7zip library - supports all types 7zip does
Invoke commands on OleDb datasources
Retrieves DB data through an OLE-DB connection
Query and retrieves SQL data
Invokes using apartment threading model
Gets a list of authorized DHCP servers.
Creates filesystem symbolic links. Requires Microsoft Windows 7 or later.
Creates shell shortcuts.
Converts a YAML file or string into object graph; navigate graph with dot notation. Comments are not retained.
Converts an object graph - suitable for YAML representation - into YAML string or file.
Set-PscxLocation
Add-DirectoryLength
Add-ShortPath
'Search-Transcript'
AddAccelerator
PscxHelp
PscxLess
Edit-Profile
Edit-HostProfile
Resolve-ErrorRecord
Resolve-HResult
Resolve-WindowsError
QuoteList
QuoteString
Invoke-GC
Invoke-BatchFile
Get-ViewDefinition
Stop-RemoteProcess
Get-ScreenCss
Get-ScreenHtml
Invoke-Method
Set-Writable
Set-FileAttributes
Set-ReadOnly
Show-Tree
Get-Parameter
Import-VisualStudioVars
Get-ExecutionTime
AddRegex
Invoke-Sudo
sudo
Mount-PscxVHD
Dismount-PscxVHD
AddAccelerator