标题: [问题求助] 求判断progid对应的com组件是否可用的PowerShell [打印本页]
作者: jyswjjgdwtdtj 时间: 2023-6-9 22:33 标题: 求判断progid对应的com组件是否可用的PowerShell
本帖最后由 jyswjjgdwtdtj 于 2024-7-22 10:55 编辑
比如这是progid.txt:- SppComApi.LicensingStateTools.1
- SppComApi.OfflineActivation
- SppComApi.OfflineActivation.1
- SppComApi.OnlineActivation
- SppComApi.OnlineActivation.1
- SppComApi.SPPLUAObject
- SppComApi.SPPLUAObject.1
- SPPUI.SPPUIObjectInteractive
- SPPUI.SPPUIObjectInteractive.1
- SPPWMI.SppWmiTokenActivationSigner
- SPPWMI.SppWmiTokenActivationSigner.1
- SQLOLEDB
复制代码
其中大部分- (new-object -comobject "soap")|get-member
复制代码
之后- TypeName:System.__ComObject
-
- Name MemberType Definition
- ---- ---------- ----------
- CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
- Equals Method bool Equals(System.Object obj)
- GetHashCode Method int GetHashCode()
- GetLifetimeService Method System.Object GetLifetimeService()
- GetType Method type GetType()
- InitializeLifetimeService Method System.Object InitializeLifetimeService()
- ToString Method string ToString()
复制代码
都是这么的平平无奇且没有任何暴露的接口
如何找出所有不是这么平平无奇的?
比如shell.application- (new-object -comobject "shell.application")|get-member
-
- TypeName:System.__ComObject#{286e6f1b-7113-4355-9562-96b7e9d64c54}
-
- Name MemberType Definition
- ---- ---------- ----------
- AddToRecent Method void AddToRecent (Variant, string)
- BrowseForFolder Method Folder BrowseForFolder (int, string, int, Variant)
- CanStartStopService Method Variant CanStartStopService (string)
- CascadeWindows Method void CascadeWindows ()
- ControlPanelItem Method void ControlPanelItem (string)
- EjectPC Method void EjectPC ()
- Explore Method void Explore (Variant)
- ExplorerPolicy Method Variant ExplorerPolicy (string)
- FileRun Method void FileRun ()
- FindComputer Method void FindComputer ()
- FindFiles Method void FindFiles ()
- FindPrinter Method void FindPrinter (string, string, string)
- GetSetting Method bool GetSetting (int)
- GetSystemInformation Method Variant GetSystemInformation (string)
- Help Method void Help ()
- IsRestricted Method int IsRestricted (string, string)
- IsServiceRunning Method Variant IsServiceRunning (string)
- MinimizeAll Method void MinimizeAll ()
- NameSpace Method Folder NameSpace (Variant)
- Open Method void Open (Variant)
- RefreshMenu Method void RefreshMenu ()
- SearchCommand Method void SearchCommand ()
- ServiceStart Method Variant ServiceStart (string, Variant)
- ServiceStop Method Variant ServiceStop (string, Variant)
- SetTime Method void SetTime ()
- ShellExecute Method void ShellExecute (string, Variant, Variant, Variant, Variant)
- ShowBrowserBar Method Variant ShowBrowserBar (string, Variant)
- ShutdownWindows Method void ShutdownWindows ()
- Suspend Method void Suspend ()
- TileHorizontally Method void TileHorizontally ()
- TileVertically Method void TileVertically ()
- ToggleDesktop Method void ToggleDesktop ()
- TrayProperties Method void TrayProperties ()
- UndoMinimizeALL Method void UndoMinimizeALL ()
- Windows Method IDispatch Windows ()
- WindowsSecurity Method void WindowsSecurity ()
- WindowSwitcher Method void WindowSwitcher ()
- Application Property IDispatch Application () {get}
- Parent Property IDispatch Parent () {get}
复制代码
- foreach($line in Get-Content "ProgID.txt"){
- $null =$job = Start-Job -ScriptBlock {
- try{
- return new-object -comobject $using:line|get-member
- }catch{}}
- $null =$job | Wait-Job -Timeout 7000
- if($job.State -ne 'Completed'){
- $null =$job|stop-job|remove-job
- continue
- }
- $c=$job | Receive-Job
- if($c -eq $null){continue}
- if(($c.length -eq 7) -and ($c[0].Name -eq "CreateObjRef")){
- }else{
- write-host $line
- }
- }
复制代码
作者: idwma 时间: 2023-6-10 16:20
- gc progid.txt|%{if(!((new-object -comobject $_)|get-member -Name ToString)){$_}}
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |