Page 1 of 1 1
Topic Options
#139909 - 2005-05-18 05:09 PM Deleteing a File out of a Users Profile - Yes i'm a newb ;>
Nikon2ks Offline
Lurker

Registered: 2005-05-18
Posts: 2
Aye yes i know i'm a newb to scripting and this is probably very easy but I need this done so we can continue our Exchange 2003 Migration.

I need to add some lines into our logon script that will delete this file everytime a user logs on.

C:\Documents and Settings\%Logonname%\Application Data\Microsoft\Outlook\Exchange.nk2

Can anyone help me out with this?

Thanks

Top
#139910 - 2005-05-18 05:25 PM Re: Deleteing a File out of a Users Profile - Yes i'm a newb ;>
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi welcome to the board!!

Dont worry we have all been there

You need to use "Del"

For more information please follow this link Del

Or even check out the manual.

Good luck

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#139911 - 2005-05-18 05:27 PM Re: Deleteing a File out of a Users Profile - Yes i'm a newb ;>
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You should never assume the path is "C:\Documents and Settings\%Logonname%\"!
You can use %USERPROFILE% or better still, pull the path from the registry.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139912 - 2005-05-18 05:31 PM Re: Deleteing a File out of a Users Profile - Yes i'm a newb ;>
Nikon2ks Offline
Lurker

Registered: 2005-05-18
Posts: 2

So adding if i'm correct

Del "%USERPROFILE%\Application Data\Microsoft\Outlook\Exchange.nk2"

Should do the trick?

Thanks guys

Best

Greg

Top
#139913 - 2005-05-18 07:08 PM Re: Deleteing a File out of a Users Profile - Yes i'm a newb ;>
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
This method might be better

Code:
$nk2=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'AppData')
If Exist($nk2+'\Microsoft\Outlook\*.nk2')=1 ;Searches for files ending with .NK2 and deletes them.
  Del($nk2+'\Microsoft\Outlook\*.nk2')
EndIf


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.191 seconds in which 0.168 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org