fso.delete(self) - how to refer to self? 
Author Message
 fso.delete(self) - how to refer to self?

Hello,

I need to update some files on a number of machines at my workplace.  I have
been sending scripts in the email for people to invoke to copy the updated
files.  But I would like to delete the scripts after they have been invoked so
that the scripts aren't getting emailed all over the place (which has happened
to me before).  I figured out some code to do this  once, but my sample file
deleted itself and I can't remember what I did :).  Could someone help me save
some time and share how to do this?

Thanks,
Rich



Mon, 18 Oct 2004 04:12:47 GMT  
 fso.delete(self) - how to refer to self?
Set fso = CreateObject("Script.FileSystemObject")
WScript.Echo "GOODBYE CRUEL WORLD!!!!"
fso.DeleteFile WScript.ScriptFullName


Quote:
> Hello,

> I need to update some files on a number of machines at my workplace.  I
have
> been sending scripts in the email for people to invoke to copy the updated
> files.  But I would like to delete the scripts after they have been
invoked so
> that the scripts aren't getting emailed all over the place (which has
happened
> to me before).  I figured out some code to do this  once, but my sample
file
> deleted itself and I can't remember what I did :).  Could someone help me
save
> some time and share how to do this?

> Thanks,
> Rich



Mon, 18 Oct 2004 04:26:58 GMT  
 fso.delete(self) - how to refer to self?
sounds like a virus


Mon, 18 Oct 2004 04:29:19 GMT  
 fso.delete(self) - how to refer to self?

Quote:

> Hello,

> I need to update some files on a number of machines at my workplace.  I have
> been sending scripts in the email for people to invoke to copy the updated
> files.

You are consciously developing bad habits in your workplace.
Keep doing it - and it will bite you badly!

You should *not* encourage people to double click on attachments
even if they seem to be coming from you. Your users should
*not* be able to touch or run any executable attachments - period.
On the assumption that mail clients are Outlook - the mere fact
that users can see executable attachments is sign of unpatched
(thus very risky to operate) mail client. Do yourself (and the
company you work for) a favour, go to Windows Update site, and
see which product updates your MSOffice is missing, also pick up
*all* critical updates for IE.

As for "script distribution problem" find some other ways, leave
e-mail out of it.

Branimir



Mon, 18 Oct 2004 04:51:28 GMT  
 fso.delete(self) - how to refer to self?
Thank you all for your posts.

I was a little afraid someone would think "VIRUS!!!".  OK.  so updating
via email scripts is a bad habit.  Hmmm.  This is an important issue.
Thinking outloud here, I support a handful of power users (maybe a dozen
people or so).  My goal was to not disrupt/interfere with
workflow/productivity.  This group of people of I support haven't had
any problems with my system in the past.  Matter of fact, the guy I
replaced used .bat files.  I upgraded that to .vbs.  In light of these
facts, and that the folks I support are not casual computer users, is it
still a bad idea to do my installs/updates via email?  I was hoping to
emulate when you download stuff from the internet and it installs
remotely.  Appreciate any thoughts.

Thanks again,
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 05:39:13 GMT  
 fso.delete(self) - how to refer to self?
Oh, the method suggested by Kit works, on the workstation, and does not
generate an error on/from the email.  But I'm not using Microsoft mail,
and the attachment is not deleting itself from the email.  Any other
possibilities for non-Microsoft mail systems?

Thanks
Rich Protzel

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 06:23:01 GMT  
 fso.delete(self) - how to refer to self?
Domain logon scripts perhaps - ask your network admin about them! [unless
that''s you of course].

Chris Barber.


Oh, the method suggested by Kit works, on the workstation, and does not
generate an error on/from the email.  But I'm not using Microsoft mail,
and the attachment is not deleting itself from the email.  Any other
possibilities for non-Microsoft mail systems?

Thanks
Rich Protzel

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 07:22:36 GMT  
 fso.delete(self) - how to refer to self?

Quote:

> Domain logon scripts perhaps - ask your network admin about them! [unless
> that''s you of course].

> Chris Barber.

Domain logon scripts could be used to distribute scripts to networked
computers, and depending on what scripts were supposed to do - "power
users" may or may not be able to run them successfully. If on the other
hand your power users have local admin powers (not that I think they should)...

Or you can roll your own solution - script that take list of systems as
input, and remotely execute script(s) of your choice against each node
(this would assume WSH 5.6 "across the board").

Branimir



Mon, 18 Oct 2004 07:44:26 GMT  
 fso.delete(self) - how to refer to self?
Oh yeah, I guess I should mention that doing the updates thing via email
is the way they do it at my workplace, orders from higher up.  I think
I've passed the probation period - been here 4+ years.  

Anyway, I'm just trying to efficienize :) the routine.  So what I am, in
essence, trying to do is to delete the attachment (the script which does
the updating) from the email after it is invoked once to prevent
accidentally overwriting files that have already been updated and put to
use (thus causing potential loss of data/work).  We use Lotus Notes mail
on our NT4 OS at my place (yeah I know, that's a whole nuther story -
and I do mega Lotus scripting).  So would anyone know if having the
script delete itself is the way to remove it from the email - or at
least prevent the attachment from being sent on in the emails?

Thanks again,
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 10:07:04 GMT  
 fso.delete(self) - how to refer to self?
That would be really, really hard to do for a specific environment without
detailed knowledge of how it is done... it *might* be doable server-side using
another mechanism if you are using Lotus Notes as a standard tool, though.

What I'm not sure about is what your current system and structure is. I saw you
mention both Lotus Notes and Microsoft mail... Who's doing what how, and where?


Quote:
> Oh yeah, I guess I should mention that doing the updates thing via email
> is the way they do it at my workplace, orders from higher up.  I think
> I've passed the probation period - been here 4+ years.

> Anyway, I'm just trying to efficienize :) the routine.  So what I am, in
> essence, trying to do is to delete the attachment (the script which does
> the updating) from the email after it is invoked once to prevent
> accidentally overwriting files that have already been updated and put to
> use (thus causing potential loss of data/work).  We use Lotus Notes mail
> on our NT4 OS at my place (yeah I know, that's a whole nuther story -
> and I do mega Lotus scripting).  So would anyone know if having the
> script delete itself is the way to remove it from the email - or at
> least prevent the attachment from being sent on in the emails?

> Thanks again,
> Rich

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 11:36:37 GMT  
 fso.delete(self) - how to refer to self?

Quote:
> ....  So what I am,
> in essence, trying to do is to delete the attachment (the script
> which does the updating) from the email after it is invoked once to
> prevent accidentally overwriting files that have already been updated
> and put to use (thus causing potential loss of data/work)...

Somehow I doubt that you will be able to do this.  A script attached to an email and executed has no clue that it was attached to an email, let alone which one.

But if your email client supports external automation, I suppose a script written specifically to be executed as an email attachment could search the user's inbox looking for an email item with an attachment whose name matches the script's name and then remove the attachment.  A little farfetched, but...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Mon, 18 Oct 2004 11:44:05 GMT  
 fso.delete(self) - how to refer to self?
This may seem a little nuts, but have you considered putting the script on a
network share, e-mail them a shortcut, and having them run it from there?
Or perhaps even setup a web page send them a link?

Just an idea.

-K


Quote:
> Oh yeah, I guess I should mention that doing the updates thing via email
> is the way they do it at my workplace, orders from higher up.  I think
> I've passed the probation period - been here 4+ years.

> Anyway, I'm just trying to efficienize :) the routine.  So what I am, in
> essence, trying to do is to delete the attachment (the script which does
> the updating) from the email after it is invoked once to prevent
> accidentally overwriting files that have already been updated and put to
> use (thus causing potential loss of data/work).  We use Lotus Notes mail
> on our NT4 OS at my place (yeah I know, that's a whole nuther story -
> and I do mega Lotus scripting).  So would anyone know if having the
> script delete itself is the way to remove it from the email - or at
> least prevent the attachment from being sent on in the emails?

> Thanks again,
> Rich

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 18 Oct 2004 19:45:14 GMT  
 fso.delete(self) - how to refer to self?
I think someone else mentioned something related to your suggestion.  Yes.  I
believe this would be the best solution.  So, lets see (review here), I create
the shortcut to my script which will live on a network share, I drag the
shortcut to the email and send it.  Viola!  Is this the idea?  Well, this is
what I am going to try.

Thanks very much for this idea.  Thank you all.

Rich



Mon, 18 Oct 2004 23:24:23 GMT  
 fso.delete(self) - how to refer to self?
Yes, I have investigate this possibility.  It <i>is</i> possible to remove
attachments from Notes emails, but I have to be able to access the Notes Object
model through automation.  I haven't had much luck using CreateObject with
Notes.  So far, I have only made references to the Notes Object libary and
bypassed CreateObject.  Thus, I might not be able to do this in vbs.

Rich



Mon, 18 Oct 2004 23:27:42 GMT  
 fso.delete(self) - how to refer to self?
I think someone else mentioned Microsoft Mail.  We use Notes exclusively at my
place.  Anyway, I am finally getting the idea of just sending a shortcut to the
scripts via email, where the scripts would reside on the network (thanks to
suggestions from other posters).  

Rich



Mon, 18 Oct 2004 23:30:09 GMT  
 
 [ 18 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Self Delete or modify

2. Self delete

3. delete items in DeletedItems Folder of self added .pst file

4. Self-Delete a file

5. self deleting executable?

6. Task Scheduler API self delete job

7. Self Delete--ANSWER!!

8. Self Delete-explain

9. Self Delete--explain again

10. Self Delete

11. SELF DELETE-TELL

12. SELF DELETE-NOT VIRUS!!!

 

 
Powered by phpBB® Forum Software