Page 1 of 1 1
Topic Options
#210657 - 2015-09-01 12:58 PM Delete file from all users except the user logging on?
Philzip Offline
Just in Town

Registered: 2015-09-01
Posts: 3
Loc: Germany
Hey all!

First of all, please excuse my language. English is not my native language, but I guess you'll be able to understand me.

In our system, every user needs a certificate to sign in to a specific system.

These certificates are unique and every user must not use a certificate of another user.

This is what we got: Everytime a user logs on, a certificate is copied from a shared folder of the server to C:\users\username\.

But if one of our coworkers signs in at another computer, he has access to the certificates of all people who signed in at this station previously. (everyone has local administrator privileges - we need that because of the software we use)

My idea is the following script:

Every time you log on, every local certificate (at c:\users\) shall be deleted except the one from the user who is signing in at this moment.

Is this possible? If yes, how?

Thank you very much!

Regards from Germany

Phil \:\)


Edited by Philzip (2015-09-01 01:00 PM)

Top
#210659 - 2015-09-01 02:21 PM Re: Delete file from all users except the user logging on? [Re: Philzip]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
If the certs are user specific, how could another user use them? Are they installed in local system store instead of personal store of the user?
_________________________
!

download KiXnet

Top
#210660 - 2015-09-01 02:24 PM Re: Delete file from all users except the user logging on? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
For a solution hack, you can use dir to list all user folders with dir() and if %userprofile% does not match delete the file. This you can run in logon, log off or scheduled script.
_________________________
!

download KiXnet

Top
#210661 - 2015-09-01 02:36 PM Re: Delete file from all users except the user logging on? [Re: Lonkero]
Philzip Offline
Just in Town

Registered: 2015-09-01
Posts: 3
Loc: Germany
 Originally Posted By: Lonkero
For a solution hack, you can use dir to list all user folders with dir() and if %userprofile% does not match delete the file. This you can run in logon, log off or scheduled script.


Sounds interesting. Unfortunately I have no idea how to realize the code.

Can you help me?

Top
#210662 - 2015-09-01 02:38 PM Re: Delete file from all users except the user logging on? [Re: Lonkero]
Philzip Offline
Just in Town

Registered: 2015-09-01
Posts: 3
Loc: Germany
 Originally Posted By: Lonkero
If the certs are user specific, how could another user use them? Are they installed in local system store instead of personal store of the user?


They are not installed, they're just files you need to logon to that certain system. Its from my development coworkers, I don't know how it works. I just manage the servers and I need to solve their request.

Top
#210664 - 2015-09-01 04:53 PM Re: Delete file from all users except the user logging on? [Re: Philzip]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so the software does not employ certificate stores at all but loads the certificate on launch?

in any case, like I said, dir() will be your ticket.

you can search the board for some dir() code and the manual most likely has an example as well. something like:
 Code:
$folder=dir('c:\users')
while $folder<>''
 if '%userprofile%'<>'c:\users\'+folder
  del 'c:\users\'+folder+'\thecertfile.cer'
 endif
$folder=dir()
loop
_________________________
!

download KiXnet

Top
#210676 - 2015-09-02 12:22 PM Re: Delete file from all users except the user logging on? [Re: Lonkero]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
I would suggest just simply delete everything in the folder, then copy in the certificate for the person currently logging in. That way, you don't have to do any testing. Just delete everything, then copy one file.
Top
#210677 - 2015-09-02 03:06 PM Re: Delete file from all users except the user logging on? [Re: BradV]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Windows vista and newer track profile folders so simply deleting everything is not a smart move.
_________________________
!

download KiXnet

Top
#210680 - 2015-09-02 06:29 PM Re: Delete file from all users except the user logging on? [Re: Lonkero]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
I just meant delete the files within the directory, not any folders. \:\)
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 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.058 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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