Skip to content

Commit

Permalink
Command based help additions, parameter piping
Browse files Browse the repository at this point in the history
* Updated command based help
* Namespace can be piped now
* Minor comment updates
  • Loading branch information
Ioan Popovici committed Feb 2, 2018
1 parent 7a40dcb commit b21a52a
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions Public/Get-WmiNameSpace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@
Function Get-WmiNameSpace {
<#
.SYNOPSIS
This function is used to get a WMI namespace.
This function is used to get WMI namespace information.
.DESCRIPTION
This function is used to get the details of one or more WMI namespaces.
.PARAMETER Namespace
Specifies the namespace path. Supports wildcards only when not using the -Recurse or -List switch.
Specifies the namespace path. Supports wildcards only when not using the -Recurse or -List switch. Can be piped.
.PARAMETER List
This switch is used to list all namespaces in the specified path.
This switch is used to list all namespaces in the specified path. Cannot be used in conjunction with the -Recurse switch.
.PARAMETER Recurse
This switch is used to get the whole WMI namespace tree recursively.
This switch is used to get the whole WMI namespace tree recursively. Cannot be used in conjunction with the -List switch.
.EXAMPLE
Get-WmiNameSpace -NameSpace 'ROOT\SCCM'
C:\PS> Get-WmiNameSpace -NameSpace 'ROOT\SCCM'
.EXAMPLE
Get-WmiNameSpace -NameSpace 'ROOT\*'
C:\PS> Get-WmiNameSpace -NameSpace 'ROOT\*CM'
.EXAMPLE
Get-WmiNameSpace -NameSpace 'ROOT' -List
C:\PS> Get-WmiNameSpace -NameSpace 'ROOT' -List
.EXAMPLE
Get-WmiNameSpace -NameSpace 'ROOT' -Recurse
C:\PS> Get-WmiNameSpace -NameSpace 'ROOT' -Recurse
.EXAMPLE
C:\PS> 'Root\SCCM', 'Root\SC*' | Get-WmiNameSpace
.INPUTS
None.
System.String[].
.OUTPUTS
None.
System.Management.Automation.PSCustomObject.
'Name'
'Path'
'FullName'
.NOTES
This is a module function and can typically be called directly.
This is a public module function and can typically be called directly.
.LINK
https://sccm-zone.com
https://github.com/JhonnyTerminus/PSWmiToolKit
.LINK
https://github.com/JhonnyTerminus/SCCM
https://sccm-zone.com
.COMPONENT
WMI
.FUNCTIONALITY
WMI Management
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,Position=0)]
[Parameter(Mandatory=$true,ValueFromPipeline,Position=0)]
[ValidateNotNullorEmpty()]
[SupportsWildcards()]
[string]$Namespace,
[string[]]$Namespace,
[Parameter(Mandatory=$false,Position=1)]
[ValidateNotNullorEmpty()]
[ValidateScript({
Expand Down Expand Up @@ -102,6 +107,7 @@ Function Get-WmiNameSpace {
$GetNamespace = $WmiNamespace | ForEach-Object {
[PSCustomObject]@{
Name = $Name = $_.Name
# Standardize namespace path separator by changing it from '/' to '\'.
Path = $Path = $_.CimSystemProperties.Namespace -replace ('/','\')
FullName = "$Path`\$Name"
}
Expand Down

0 comments on commit b21a52a

Please sign in to comment.