powershell GET-ComObject.ps1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell GET-ComObject.ps1相关的知识,希望对你有一定的参考价值。

function Get-ComObject {
<#
.Synopsis
Returns a list of ComObjects

.DESCRIPTION
This function has two parameter sets, it can either return all ComObject or a sub-section by the filter parameter. This information is gathered from the HKLM:\Software\Classes container.

.NOTES   
Name: Get-ComObject
Author: Jaap Brasser
Version: 1.0
DateUpdated: 2013-06-24

.LINK
http://www.jaapbrasser.com

.PARAMETER Filter
The string that will be used as a filter. Wildcard characters are allowed.
	
.PARAMETER ListAll
Switch parameter, if this parameter is used no filter is required and all ComObjects are returned

.EXAMPLE
Get-ComObject -Filter *Application

Description:
Returns all objects that match the filter

.EXAMPLE
Get-ComObject -Filter ????.Application

Description:
Returns all objects that match the filter

.EXAMPLE
Get-ComObject -ListAll

Description:
Returns all ComObjects
#>
    param(
        [Parameter(Mandatory=$true,
        ParameterSetName='FilterByName')]
            [string]$Filter,
        [Parameter(Mandatory=$true,
        ParameterSetName='ListAllComObjects')]
            [switch]$ListAll
    )
    $ListofObjects = Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | 
    Where-Object {
        $_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID")
    } | Select-Object -ExpandProperty PSChildName 
    
    if ($Filter) {
        $ListofObjects | Where-Object {$_ -like $Filter}
    } else {
        $ListofObjects
    }
}

以上是关于powershell GET-ComObject.ps1的主要内容,如果未能解决你的问题,请参考以下文章

powershell怎么运行

powershell PowerShell:启动PowerShell作为其他用户提升

powershell [提示输入powershell] #powershell #input #prompt

powershell 测量PowerShell命令或PowerShell脚本的速度

powershell远程下载exe并执行

powershell 使用啥端口