Results 1 to 11 of 11

Thread: UnauthorizedAccessException, need help!

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39

    Question UnauthorizedAccessException, need help!

    Hello, Is there any way to avoid UnauthorizedAccessException, i get it every time when I try to do this:
    Code:
    My.Computer.Registry.ClassesRoot.OpenSubKey("Applications").CreateSubKey("Explorer.exe")
    Is there any way to make that script read-write?
    Thanks!

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: UnauthorizedAccessException, need help!

    Let me guess, you're probably using Windows Vista ¿
    VB.NET MVP 2008 - Present

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39

    Re: UnauthorizedAccessException, need help!

    I'm using Windows 7

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: UnauthorizedAccessException, need help!

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

  5. #5
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: UnauthorizedAccessException, need help!

    Add True as an argument when opening the key. Otherwise, the default is False which is ReadOnly. If that doesn't work, you'll need to elevate permissions.
    Last edited by weirddemon; Jan 21st, 2010 at 12:24 PM. Reason: Same as usual: Spelling mistkes ;)
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39

    Re: UnauthorizedAccessException, need help!

    If you mean like this:
    vb Code:
    1. My.Computer.Registry.ClassesRoot.OpenSubKey("Applications").OpenSubKey("Explorer.exe").CreateSubKey("Drives", True)
    It doesn't work, but how do I elevate permissions?

  7. #7
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: UnauthorizedAccessException, need help!

    Quote Originally Posted by Prato95 View Post
    If you mean like this:
    vb Code:
    1. My.Computer.Registry.ClassesRoot.OpenSubKey("Applications").OpenSubKey("Explorer.exe").CreateSubKey("Drives", True)
    It doesn't work, but how do I elevate permissions?
    No. I said add it to the Opening Key part, not when creating the key -_-

    VB.NET Code:
    1. My.Computer.Registry.ClassesRoot.OpenSubKey("Applications").OpenSubKey("Explorer.exe", True ).CreateSubKey("Drives")

    Even if you elevate permissions, you'll need to change the write permissions like I said.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39

    Re: UnauthorizedAccessException, need help!

    I didn't read the post well
    But it doesn't work
    How to elevate permissions?

  9. #9
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: UnauthorizedAccessException, need help!

    Quote Originally Posted by Prato95 View Post
    I didn't read the post well
    But it doesn't work
    How to elevate permissions?
    1. It worked for me.
    2. Google. Do a little leg work
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2009
    Location
    Finland
    Posts
    39

    Re: UnauthorizedAccessException, need help!

    1. Do not work in Windows 7
    2. Googled. Jogging didn't help.
    What now?

  11. #11
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: UnauthorizedAccessException, need help!

    Quote Originally Posted by Prato95 View Post
    1. Do not work in Windows 7
    2. Googled. Jogging didn't help.
    What now?
    You figure out on our own now. I was trying to help you help yourself, but you decided to be a jerk.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

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