$Printer=Get-WmiObject Win32_Printer | Where-Object Name -eq "DocuWorks Printer" $Printer.SetDefaultPrinter()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim runspaceInvoke As RunspaceInvoke = New RunspaceInvoke() Dim printer As Object = runspaceInvoke.Invoke("Get-WmiObject Win32_Printer | Where-Object Name -eq ""DocuWorks Printer""") printer.SetDefaultPrinter() '★ここでエラー printer(0).SetDefaultPrinter()でもNG End Sub
$Printers=Get-WmiObject Win32_Printer $Printer=$Printers | Where-Object Name -eq "DocuWorks Printer" $Printer.DefaultPaperType="A3" $Printer.Put()