假设这个文件包含了要部署打印机的计算机名称列表 $printerName = "打印机名称" $driverName = "驱动名称" $portName = "端口名称" foreach ($computer in $computers) { Invoke-Command -ComputerName $computer -ScriptBlock { Add-Printer -Name $using:printerName -DriverName $using:driverName -PortName...
Enter and execute this command, replacing<printserver>and<printername>with your environment information: Add-Printer-ConnectionName \\<printserver>\<printername> Nice and easy. The print server adds the driver to the store, installs the printer driver, creates the printer port, and installs the...
}$WPFPrinterBox.ItemsSource =$Printers# Install selected printer$WPFAddPrinter.Add_Click({$PrinterName= $$Printserver=$WPFPrinterBox.SelectedItem.ComputerName$msgBoxInput= [System.Windows.MessageBox]::Show("$PrinterNamewill be added to your computer", 'Add Printer', 'YesNo') Switch ($msgBoxInpu...
Get-Command : 'Is-NotACommand' isn't recognized as a cmdlet, function, operable program, or script file. At line:1 char:12 + Get-Command <<< Is-NotACommand | Out-Null 列印數據 Out-Printer僅適用於 Windows 平臺。 您可以使用Out-Printercmdlet 列印資料。 如果您沒有提供印表機名稱,CmdletOut...
It turns out the driver from the INF file can be added under one specific condition — only if the DriverStore driver storage contains it. Logically, using the Add-PrinterDriver command to install a driver not available in the system driver storage is impossible. To install the driver in Driv...
If I select a printer driver from the previous list, and clickNext, the driver installs. I can verify this via theGet-PrinterDriverfunction, as shown here: Get-PrinterDriver The following image shows the command and its output. I can then use theGet-PrinterDriverfunction to retri...
mycommand.name))来标识当前命令。对于查找正在运行的脚本的名称,这非常有用。 $NULL 包含NULL 或空值。可以在命令和脚本中使用此变量表示 NULL,而不是使用字符串”NULL”。如果该字符串转换为非空字符串或非零整数,则可将该字符串解释为 TRUE。 $PID 包含承载当前 Windows PowerShell 会话的进程的进程标识符 (...
例如,Get-Command cmdlet 检索 PowerShell 中注册的所有命令。 备注 PowerShell 使用术语 谓词 来描述一个单词,即使该单词不是英语中的标准谓词也是如此。 例如,术语 “新建” 是有效的 PowerShell 谓词名称,因为它表示作,即使它不是英语中的谓词。 每个批准的谓词都有一个相应的 别名前缀, 定义。 对于...
This command adds a printer with name mxdw2 to the local computer. The mxdw printer uses the Microsoft XPS Document Writer v4 driver and the portprompt: port. The portprompt: port prompts for a file name to save the XPS document when printing to the XPS printer. Add...
了解名词和谓词有助于使用Get-Commandcmdlet 查找命令。 例如,若要查找使用谓词的Get命令: PowerShell Get-Command-VerbGet-ModuleUniversalPrintManagement 若要获取包含示例的 cmdlet 详细信息,请参阅: PowerShell Get-HelpGet-UPPrinter-Detailed [注意]UniversalPrintManagementGetcmdlet 现在返回带有继续标记的结果,以允...