Jump to content

how to delete a file in system32\spool folder


Jamal
 Share

Recommended Posts

  • Developers

could you please let me knnow how to delete a file without giving username or domain?

thanks

What are you trying to do? (you are a little vague to say the least.)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What are you trying to do? (you are a little vague to say the least.)

Sorry I was rushing,

if FileExists("c:\windows\system32\spool\drivers\w32x86\somefile.dll") then

FileDelete("c:\windows\system32\spool\drivers\w32x86\somefile.dll")

EndIf

thanks again

Link to comment
Share on other sites

  • Developers

Sorry I was rushing,

if FileExists("c:\windows\system32\spool\drivers\w32x86\somefile.dll") then

FileDelete("c:\windows\system32\spool\drivers\w32x86\somefile.dll")

EndIf

thanks again

Why do you want to remove these files?

What OS and what level rights are you trying this?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Why do you want to remove these files?

What OS and what level rights are you trying this?

Jos

The file under system32 is something my company installs on customer computers.

need to remove it without asking/entering customer username and password

thanks

Link to comment
Share on other sites

  • Developers

Why is it so difficult to answer my few simple questions?

How can you expect proper answers without being clear to us?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The file under system32 is something my company installs on customer computers.

need to remove it without asking/entering customer username and password

thanks

You are either not willing or not able to read between the lines in Jos's question, so I'll be more clear:

You are trying to do something that could possibly have malicious intent (meaning it could be a virus or a nasty joke or whatever) or it could be that you have good reasons. If you want help, you are going to have to explain first and foremost why exactly you would want to delete system files, like "it is a file that an application X creates and I have to help the customer do Y so I need to remove Z". Apart from that: explain what your problem is: what code have you written and what exactly goes wrong? And to be able to help you even if you have good intentions, it is still necessary to know what operating system you are working with and what authority level you have with your script.

/edit: sorry Jos just wanted to save you some time :graduated: Not meaning to put words into your mouth.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

  • Developers

I honestly didn't have any suspicion about this post but simply do not understand why you want to remove printer drivers from customers systems by deleting files.

So with these type of questions the case needs to be clear and you should demonstrate you know what you are doing to avoid shooting yourself in the foot.

Anyway, I do not mind helping but am not good at "pulling teeth".

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I honestly didn't have any suspicion about this post but simply do not understand why you want to remove printer drivers from customers systems by deleting files.

So with these type of questions the case needs to be clear and you should demonstrate you know what you are doing to avoid shooting yourself in the foot.

Anyway, I do not mind helping but am not good at "pulling teeth".

Alright,

Let me start this again. I just started working at a company and this company sells customer label printers and its software. The printer drivers are not designed well and creates problems between version updates. When a customer calls in and compalins that are some communication problems, we have to login to their computer and remove printer, it's drivers and driver files that gets installed into system32 folder.

So, my goal was to have the customer download a file , run it and remove these files before they download the latest files.

With this small application I like this application to remove these files without asking/entering username, password because most of our customers are companies that have enterprise windows XP environment.

I was able to delete files under a folder located under c:\tmpwork but everytime I try to delete files from c:\windows\system32 folder code can't delete them. I am sure it is permission problem, but I don't know how to delete files without giving permissions.

I don't know how much more clear I can be. I need this help pretty soon because I told them I can do this but couldn't do it. It is very embarrising.

thanks

Link to comment
Share on other sites

  • Developers

Ok, this makes it clearer.

So do you have this issue consequently...ie also when you test yourself on your own system having Admin rights?

Could it be that the driver is loaded/inuse and cannot be deleted?

One thing you could test is to do a "net stop spooler" and then try again to see if that frees up the file.

As you can see from my question its a little difficult to test unless we have a scenario to test with.

PS. it could be the driver is protected by a GPO in which case I am not so sure you can script around it.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Maybe something to look at as well: http://technet.microsoft.com/en-us/library/bb490972.aspx

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I have tried running RUNDLL32 PRINTUI.DLL,PrintUIEntry application with proper options. When I run this command in command prompt, it works. I am able to remove the printer from printers & fax list window. Also I can remove the printer from server list too.

PROBLEM is deleting those items and settings from system not necessarily delete their files from system32/drivers folder.

I think my autoit filedelete command is not successful because windowsXP is not giving permission. I want script to delete the file without asking/needing user permission.

Thanks.

Link to comment
Share on other sites

Jamal,

Evidently -- whatever you're using to remove the drivers is not working. Thats what you should be looking at.

Perhaps, unregistering the driver?

However, since major manufacturers have problems removing their software from a PC .. this is what you'll need:

(2 scripts)

; Rename the file
Local $file_In = "c:\windows\system32\spool\drivers\w32x86\somefile.dll"
Local $fileOut = "c:\windows\system32\spool\drivers\w32x86\somefile.bak"

If FileMove($file_In, $fileOut, 1) = 1 Then
    MsgBox(8256, "Prompt", "File Renamed")
Else
    MsgBox(8208, "Prompt", "File Not Renamed")
EndIf

Restart the PC to release lock on it - then ...

; Delete the file
Local $fileOut = "c:\windows\system32\spool\drivers\w32x86\somefile.bak"

If FileDelete($fileOut) = 1 Then
   MsgBox(8256, "Prompt", "File Deleted")
Else
   MsgBox(8208, "Prompt", "File Not Deleted")
EndIf

Usually, Windows will complain about a missing file -- you'll need to unregister that file.

-edit-

Or you can replace that file with the new file (same filename). Will need to restart PC again.

Edited by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...