Jump to content


lordx

Established Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by lordx

  1. I have used:

    $ComputerlistPath = 'c:\temp\computerlist.txt'
    $ComputerList = Get-Content -Path $ComputerlistPath; # one computer a line
    foreach ($computer in $computerList){
        ($computer + ": " + @(Get-WmiObject -ComputerName $computer -Namespace root\cimv2 -Class Win32_ComputerSystem)[0].UserName);
    }
    

    To get this information a few times. you can probably use this as a basis to make a script do what you want.

  2. Removing all network printers is not that difficult with Powershell on the win7 machines. This one liner will remove all network printer connections:

     

    Get-WMIObject Win32_Printer | where{$_.Network -eq ‘true’} | foreach{$_.delete()}

     

     

    But this will only remove the connections If you want to remove the drivers also you need to use prnmgr.vbs see: http://technet.microsoft.com/en-us/library/cc725868(WS.10).aspx

     

    The script i used earlier this year to achieve almost the exact same thing as you was this script.:

     

     

    #Delete_printers.ps1

    Write-Host ‘Tar bort alle Nettverksskrivere fra “Enheter og skrivere”‘ -ForegroundColor Green

    Get-WMIObject Win32_Printer | where{$_.Network -eq ‘true’} | foreach{$_.delete()}

    Write-Host ‘Restart Print Spooler’ -ForegroundColor Green
    (get-wmiobject -Class win32_service -filter “Name=’Spooler’”).stopservice()
    sleep 5
    (get-wmiobject -Class win32_service -filter “Name=’Spooler’”).startservice()
    sleep 10

    Write-Host ‘Sletter Driverne’ -ForegroundColor Green
    Invoke-Expression “cscript C:\Windows\system32\Printing_Admin_Scripts\en-US\prndrvr.vbs -x”

     

     

    After this is run use GPOs or a login script to set the new printers.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.