Results 1 to 11 of 11

Thread: [RESOLVED] Syste,io.FileInfo on netwrok PC's work only when logged in.

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Resolved [RESOLVED] Syste,io.FileInfo on netwrok PC's work only when logged in.

    Hello.
    I'm using FileInfo to determine if a file exists on a network PC and then delete it.
    I'm running the app from the desktop of the main server that has full permissions.
    The FileInfo only works when the PC that I want to delete a file has someone logged in to it, otherwise it will not work.
    The app is winforms (soIUSR accound is not used) .
    Also let me mention that if I use the file explorer to delete the file while the PC is not logged in, it works fine.

    So any advice? Should I use impersonation? I kinda not want to as the admin pass for the main server changed from time to time.

    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Is it returning an exception?

    What is the code that you're running to delete the file?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Hi.
    No exception unfortunately.
    A first check before deleting the file is FileInfo.Exists that returns False
    I have also tried to go straight to FileInfo.Delete() , it doesn't really do anything, no exception, there is no return value on delete so I can check something .
    I have also tried with some of our PC's that have lower privileges than the initial PC's and it works fine on them.
    So Less privilege PC's = OK , Administrative PC's = only deletes if someone is logged in.
    This is strange.

    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Quote Originally Posted by sapator View Post
    Hello.
    I'm using FileInfo to determine if a file exists on a network PC and then delete it.
    I'm running the app from the desktop of the main server that has full permissions.
    The FileInfo only works when the PC that I want to delete a file has someone logged in to it, otherwise it will not work.
    The app is winforms (soIUSR accound is not used) .
    Also let me mention that if I use the file explorer to delete the file while the PC is not logged in, it works fine.

    So any advice? Should I use impersonation? I kinda not want to as the admin pass for the main server changed from time to time.

    Thanks.
    Can you set up where the files are as a share and give the proper permissions? Also what does "otherwise it will not work" mean. You must get some kind of response back.
    Please remember next time...elections matter!

  5. #5

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    I think delete just go to the next line without a response.
    I will have to check that again tomorrow but I think it just skips.
    About share.
    I have tried on share and non share it does the same as mentioned above. I don't know exactly what permissions to give the files as when the - to delete- PC is logged on it works fine.
    So what permissions do I need when logged and what when not logged? Also I don't want to change permissions and since the server(that I am running this) has full permissions, I don't think it will make a difference.
    Also .Exists returns false for the file , so as a first step , before I go to the delete debugging, this should have returned True as the file clearly exists.
    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Poking around on the interwebs, it looks like the behavior can be replicated when the operating system making the call is a 64-bit operating system.

    So as a shot in the dark, is the OS 32-bit on the computers that do work and 64-bit on the one that doesn't?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Hi.
    As per low privilege PC's some are 32bit some 64 bit but they all work.
    I'm not sure right now on the admin PC's that do not work but I could check tomorrow.
    When you say the behavior, do you mean only with a logged in user or not working at all?
    If what you say is true then it should be a mixture of both OS and Privilege when we combine all the cases.

    Tomorrow I will try to copy a file to see if I get any exception other than SecurityException because that clearly is not risen on .Delete
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  8. #8
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    This is the thread that I found related to the same issue you're experiencing: https://stackoverflow.com/questions/...ile-does-exist
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  9. #9
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    I think delete just go to the next line without a response.
    A called function fails without a response. I seriously doubt that.
    Please remember next time...elections matter!

  10. #10

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Syste,io.FileInfo on netwrok PC's work only when logged in.

    Damn!
    Double Damn!
    Triple Damn!!!
    Default !@#$% Windows settings. It was only showing the file not the extension so i was trying to delete myfile.txt.txt instead of myfie.txt
    But thanks for the effort guys.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: [RESOLVED] Syste,io.FileInfo on netwrok PC's work only when logged in.

    Yeah, I hate that setting. It's a nice way to hide malicious files, too.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width