Thursday, 15 December 2016

POWER SHELL SCRIPT TO CONFIGURE SEPARATOR PAGE (PRINTER)



$username = "administrator"
$password = "pass**" | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$printer = GET-WMIOBJECT -query "select * from Win32_Printer where Name='${workflow.scratchpad.printer}'" -ComputerName ${workflow.scratchpad.serverip} -Credential $credential
$query = "Select * From Win32_TCPIPPrinterPort where Name ='" + $printer + "'"
foreach ($objItem in $printer) {
     
       $objItem.SeparatorFile = "C:\WINDOWS\system32\sysprint.sep"
  $objItem.put()
     
}
Write-Host "$query"

No comments:

Post a Comment

Git

1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...