mardi 4 novembre 2014

Removing text from ouput powershell


Vote count:

0




Good Afternoon All,


I am trying to remove part of the text that is returned from the get-wmiobject, the text I am trying to remove is @{ShareName=PRT47}and i only want the printer name that is returned so the suffix if you will.


I Have tried different by attempting to get the number of characters and delete them but I have since found out that you can also use what is in the proceeding cmdlet.


Remove Text



$text = Get-WmiObject -Class $class -Filter Network=True | Select ShareName | Where-Object {$_ - like "*PRT*"}
ForEach ($shareName in $text) {
$newprinter = "\\$newserver\$shares"
rundll32 printui.dll,PrintUIEntry /in /n $newprinter
}


asked 18 secs ago







Removing text from ouput powershell

Aucun commentaire:

Enregistrer un commentaire