最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PowerShell中使用PrintManagement管理打印機(jī)示例

 更新時間:2015年03月26日 09:25:24   投稿:junjie  
這篇文章主要介紹了PowerShell中使用PrintManagement管理打印機(jī)示例,本文給出了一個安裝打印機(jī)驅(qū)動和打印機(jī)端口的例子,需要的朋友可以參考下

適用于Windows 8.1或者Windows Server 2012 R2

Windows 8.1和Windows Server 2012 R2引入了一個組件:“PrintManagement”,它包含了所有用來管理本地和遠(yuǎn)程機(jī)器打印機(jī)的命令。

下面的例子演示安裝打印機(jī)驅(qū)動和打印機(jī)端口,先安裝一個打印機(jī),分享它,并設(shè)置一些屬性。

復(fù)制代碼 代碼如下:

$ComputerName = $env:COMPUTERNAME
 
$DriverName = 'Samsung SCX-483x 5x3x Series XPS'
$IPAddress = '192.168.2.107'
$PortName = 'NetworkPrint_192.168.2.107'
$PrinterName = 'BWPrint'
$ShareName = 'Office 12'
 
Add-PrinterDriver -ComputerName $ComputerName -Name $DriverName
Add-PrinterPort -Name $PortName -ComputerName $ComputerName
Add-Printer -ComputerName $ComputerName -Name $PrinterName -DriverName $DriverName -Shared -ShareName $ShareName -PortName $PortName
Set-PrintConfiguration -ComputerName $ComputerName -PrinterName $PrinterName -PaperSize A4

當(dāng)然,你要運(yùn)行它,得確保調(diào)整變量 $IPAddress 指向真實存在的打印機(jī)地址。把$ComputerName 從本地機(jī)器名更改為遠(yuǎn)程機(jī)器名。

可以這樣查看PrintManagement 組件中所有的PowerShell命令:

復(fù)制代碼 代碼如下:

PS> Get-Command -Module PrintManagement

CommandType     Name                                               ModuleName                                              
-----------     ----                                               ----------                                              
Function        Add-Printer                                        PrintManagement                                         
Function        Add-PrinterDriver                                  PrintManagement                                         
Function        Add-PrinterPort                                    PrintManagement                                         
Function        Get-PrintConfiguration                             PrintManagement                                         
Function        Get-Printer                                        PrintManagement                                         
Function        Get-PrinterDriver                                  PrintManagement                                         
Function        Get-PrinterPort                                    PrintManagement                                         
Function        Get-PrinterProperty                                PrintManagement                                         
Function        Get-PrintJob                                       PrintManagement                                         
Function        Read-PrinterNfcTag                                 PrintManagement                                         
Function        Remove-Printer                                     PrintManagement                                         
Function        Remove-PrinterDriver                               PrintManagement                                         
Function        Remove-PrinterPort                                 PrintManagement                                         
Function        Remove-PrintJob                                    PrintManagement                                         
Function        Rename-Printer                                     PrintManagement                                         
Function        Restart-PrintJob                                   PrintManagement                                         
Function        Resume-PrintJob                                    PrintManagement                                         
Function        Set-PrintConfiguration                             PrintManagement                                         
Function        Set-Printer                                        PrintManagement                                         
Function        Set-PrinterProperty                                PrintManagement                                         
Function        Suspend-PrintJob                                   PrintManagement                                         
Function        Write-PrinterNfcTag                                PrintManagement

其實,它們只是一些PowerShell函數(shù),而不是編譯的二進(jìn)制命令。

相關(guān)文章

  • Windows Powershell 介紹和安裝

    Windows Powershell 介紹和安裝

    Powershell 是運(yùn)行在windows機(jī)器上實現(xiàn)系統(tǒng)和應(yīng)用程序管理自動化的命令行腳本環(huán)境。微軟之所以將Powershell 定位為Power,并不是夸大其詞,因為它完全支持對象。其可讀性,易用性,可以位居當(dāng)前所有shell之首。
    2014-08-08
  • Windows Powershell創(chuàng)建對象

    Windows Powershell創(chuàng)建對象

    .Net類型中的方法功能很強(qiáng)大??梢酝ㄟ^類型的構(gòu)造函數(shù)創(chuàng)建新的對象,也可以將已存在的對象轉(zhuǎn)換成指定的類型。
    2014-10-10
  • PowerShell String對象方法小結(jié)

    PowerShell String對象方法小結(jié)

    這篇文章主要介紹了PowerShell String對象方法,需要的朋友可以參考下
    2015-07-07
  • PowerShell命令中包含空格如何運(yùn)行?

    PowerShell命令中包含空格如何運(yùn)行?

    這篇文章主要介紹了PowerShell命令中包含空格如何運(yùn)行?即在PowerShell中運(yùn)行包含空格的命令的方法,需要的朋友可以參考下
    2014-08-08
  • PowerShell入門教程之Cmd命令與PowerShell命令相互調(diào)用的方法

    PowerShell入門教程之Cmd命令與PowerShell命令相互調(diào)用的方法

    這篇文章主要介紹了PowerShell入門教程之Cmd命令與PowerShell命令相互調(diào)用的方法,本文講解了在Cmd命令中調(diào)用PowerShell命令、在PowerShell命令中調(diào)用Cmd命令的方法,需要的朋友可以參考下
    2014-10-10
  • PowerShell打開或關(guān)閉光驅(qū)

    PowerShell打開或關(guān)閉光驅(qū)

    這里給大家分享的是使用PowerShell實現(xiàn)打開或關(guān)閉光驅(qū)的小程序,大家也許根本用不到,這里只是個例子,讓大家學(xué)習(xí)下如何操作windows API
    2015-09-09
  • PowerShell中使用curl(Invoke-WebRequest)的方法教程

    PowerShell中使用curl(Invoke-WebRequest)的方法教程

    這篇文章主要給大家介紹了關(guān)于在PowerShell中使用curl(Invoke-WebRequest)的方法教程,文中通過詳細(xì)的示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。
    2017-08-08
  • 探索PowerShell(一) 初識 PowerShell

    探索PowerShell(一) 初識 PowerShell

    PowerShell是一個由微軟的提供的全新shell程序,使用了全新的命令提示和腳本環(huán)境
    2012-12-12
  • PowerShell中prompt函數(shù)的妙用

    PowerShell中prompt函數(shù)的妙用

    這篇文章主要介紹了PowerShell中prompt函數(shù)的妙用,例如自定義命令提示符,在提示符中自動輸出當(dāng)前路徑等技巧,需要的朋友可以參考下
    2014-08-08
  • PowerShell實現(xiàn)統(tǒng)計函數(shù)嵌套深度

    PowerShell實現(xiàn)統(tǒng)計函數(shù)嵌套深度

    這篇文章主要介紹了PowerShell實現(xiàn)統(tǒng)計函數(shù)嵌套深度,本文分享一個函數(shù),可以實現(xiàn)統(tǒng)計腳本執(zhí)行的嵌套層次,需要的朋友可以參考下
    2015-06-06

最新評論

青河县| 沾化县| 增城市| 洪洞县| 开江县| 三穗县| 堆龙德庆县| 大兴区| 仙居县| 寿光市| 漳平市| 吴桥县| 五家渠市| 邳州市| 阿克陶县| 射洪县| 福安市| 张掖市| 怀远县| 怀仁县| 济宁市| 佛坪县| 双鸭山市| 阿克陶县| 富平县| 丽水市| 南岸区| 连南| 瑞金市| 大兴区| 遂昌县| 阳朔县| 铜川市| 曲麻莱县| 汨罗市| 曲松县| 隆化县| 杭锦后旗| 宝丰县| 无为县| 宁都县|