Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Removing Printers

Reply
 
Old 12-04-2007   #1 (permalink)
malckelly


 
 

Removing Printers

I am trying to find info on writing a script that can automate the removal of
the "Microsoft XPS Document Writer". I couldn't find a powershell command to
do it or WMI Class that could help me. Win32_printer seems to have a method
to add printers but not remove.

Can anyone give me a few pointers?

My System SpecsSystem Spec
Old 12-04-2007   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: Removing Printers

malckelly wrote:
Quote:

> I am trying to find info on writing a script that can automate the removal of
> the "Microsoft XPS Document Writer". I couldn't find a powershell command to
> do it or WMI Class that could help me. Win32_printer seems to have a method
> to add printers but not remove.
>
> Can anyone give me a few pointers?
Strangely:
http://www.microsoft.com/technet/scr...5/hey1201.mspx

On XP SP2, I looked for the Delete_ method, but can't find it. I also
tried via wmic (in case PowerShell had a problem with the "_" somehow in
a method name).

What operating system(s)?

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 12-04-2007   #3 (permalink)
malckelly


 
 

Re: Removing Printers

Sorry I should have said. Its Vista 32bit

"Marco Shaw [MVP]" wrote:
Quote:

> malckelly wrote:
Quote:

> > I am trying to find info on writing a script that can automate the removal of
> > the "Microsoft XPS Document Writer". I couldn't find a powershell command to
> > do it or WMI Class that could help me. Win32_printer seems to have a method
> > to add printers but not remove.
> >
> > Can anyone give me a few pointers?
>
> Strangely:
> http://www.microsoft.com/technet/scr...5/hey1201.mspx
>
> On XP SP2, I looked for the Delete_ method, but can't find it. I also
> tried via wmic (in case PowerShell had a problem with the "_" somehow in
> a method name).
>
> What operating system(s)?
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Old 12-04-2007   #4 (permalink)
urkec


 
 

Re: Removing Printers

"Marco Shaw [MVP]" wrote:
Quote:

> malckelly wrote:
Quote:

> > I am trying to find info on writing a script that can automate the removal of
> > the "Microsoft XPS Document Writer". I couldn't find a powershell command to
> > do it or WMI Class that could help me. Win32_printer seems to have a method
> > to add printers but not remove.
> >
> > Can anyone give me a few pointers?
>
> Strangely:
> http://www.microsoft.com/technet/scr...5/hey1201.mspx
>
> On XP SP2, I looked for the Delete_ method, but can't find it. I also
> tried via wmic (in case PowerShell had a problem with the "_" somehow in
> a method name).
>
I think this can be done by casting the Win32_Printer instance to
System.Management.ManagementObject and then use it's Delete() method.

[System.Management.ManagementObject]$printer.Delete()

--
urkec




--
urkec



My System SpecsSystem Spec
Old 12-17-2007   #5 (permalink)
steve


 
 

Re: Removing Printers

I'm a bit late, but I just had to remove some printers myself.
The WMI object returned by Get-WMIObject does have a delete
scriptmethod.


TypeName: System.Management.ManagementObject#root
\cimv2\Win32_Printer



TypeName: System.Management.ManagementObject#root
\cimv2\Win32_Printer

Name MemberType Definition
---- ---------- ----------
ConvertFromDateTime ScriptMethod System.Object
ConvertFromDateTime();
ConvertToDateTime ScriptMethod System.Object
ConvertToDateTime();
Delete ScriptMethod System.Object Delete();
GetType ScriptMethod System.Object GetType();
Put ScriptMethod System.Object Put();



On Dec 4, 9:36 am, urkec <ur...@xxxxxx> wrote:
Quote:

> "Marco Shaw [MVP]" wrote:
Quote:

> > malckelly wrote:
Quote:

> > > I am trying to find info on writing a script that can automate the removal of
> > > the "Microsoft XPS Document Writer". I couldn't find a powershell command to
> > > do it or WMI Class that could help me. Win32_printer seems to have a method
> > > to add printers but not remove.
>
Quote:
Quote:

> > > Can anyone give me a few pointers?
>>
Quote:

> > On XP SP2, I looked for the Delete_ method, but can't find it. I also
> > tried via wmic (in case PowerShell had a problem with the "_" somehow in
> > a method name).
>
> I think this can be done by casting the Win32_Printer instance to
> System.Management.ManagementObject and then use it's Delete() method.
>
> [System.Management.ManagementObject]$printer.Delete()
>
> --
> urkec
>
> --
> urkec
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Removing Network Printers - Two Quick Questions Please VB Script
Removing network printers Vista General
Re: Removing network printers Vista print fax & scan
USB Printer Ports still there after removing printers Vista print fax & scan
removing associated Norton files form windows security as it still appears in security centre after removing from registry, application common folders etc Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46