Sign in to follow this  
Followers 0

how to delete a file in system32\spool folder

13 posts in this topic

Posted

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

thanks

Share this post


Link to post
Share on other sites



Posted

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.)

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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".

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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.

Share this post


Link to post
Share on other sites

Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.