Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

how to delete a file in system32\spool folder


  • Please log in to reply
12 replies to this topic

#1 Jamal

Jamal

    Seeker

  • Active Members
  • 7 posts

Posted 24 November 2010 - 07:31 PM

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

thanks







#2 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 24 November 2010 - 07:34 PM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 Jamal

Jamal

    Seeker

  • Active Members
  • 7 posts

Posted 24 November 2010 - 07:47 PM

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

#4 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 24 November 2010 - 07:49 PM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#5 Jamal

Jamal

    Seeker

  • Active Members
  • 7 posts

Posted 24 November 2010 - 08:48 PM

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

#6 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 24 November 2010 - 08:53 PM

Why is it so difficult to answer my few simple questions?
How can you expect proper answers without being clear to us?

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#7 SadBunny

SadBunny

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 744 posts

Posted 24 November 2010 - 08:58 PM

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, 24 November 2010 - 08:59 PM.

Roses are FF0000Violets are 0000FFAll my base are belong to you

#8 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 24 November 2010 - 09:05 PM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#9 Jamal

Jamal

    Seeker

  • Active Members
  • 7 posts

Posted 25 November 2010 - 08:37 PM

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

#10 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 25 November 2010 - 09:16 PM

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, 25 November 2010 - 09:22 PM.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#11 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,351 posts

Posted 25 November 2010 - 09:31 PM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#12 Jamal

Jamal

    Seeker

  • Active Members
  • 7 posts

Posted 26 November 2010 - 07:43 PM

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.

#13 ripdad

ripdad

    Member

  • Active Members
  • PipPipPipPipPipPip
  • 748 posts

Posted 26 November 2010 - 10:24 PM

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, 26 November 2010 - 10:37 PM.

I'm pretty sure this script has "some flaws" (somewhere). Welcome to programming!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users