|
|
|||||||
Hi, I have created a function that will hide drive depending on drive letter inputted via function. Code:
For users that don't understand "NoDrive", I have included a quote from Microsoft. Quote: Now the problem with my function, is it cannot not detect if that drive is already hidden. So say my registry entry is set to 6 (B & C hidden), and I then say I want to hide drive C, it will add 2 to the registry value giving you a total of 8. You see my problem. Now if I was any good at maths, I could work out a procedure to say if registry = 8, then drives B & C must be hidden. Hope this makes sence, and if anyone could come up with a bright idea ? Thanks Richard |
||||||||
|
|
|||||||
No real math needed, just a bitwise &. See this example: http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=81649&an=0&page=0#81649 |
||||||||
|
|
|||||||
Thanks Les, I will go through it and post a updated working function. Thanks |
||||||||
|
|
|||||||
And here is a larger discussion on the subject that might prove helpful to you. what is this binary not operand http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=146279 And a bit more on the subject Help converting VBS code to KiXtat http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=158770 |
||||||||
|
|
|||||||
This basically is also done by he GPO, you could edit %windir%\inf\system.adm to include the drives you want to hide or prevent access to. Code:
You can add as many drives as you want using the same hex codes. ABC would be 1 + 2 + 4 = 7 Keep in mind that every line you add to that that you also have to specify that in the [strings] section of the system.adm file. |
||||||||
|
|
|||||||
Thanks for the replies, internet at home was down last night so haven't had a chance to look at it. I know what NoDrive does, and we don't use GP's as they run like a snail on Windows 2000 when using mandatory profiles. |
||||||||
|
|
|||||||
Stop the roaming profiles and go easy on GPO Roaming is just DOG SLOW even on 100MB links. GPO are good for some things, but I think a lot of shops go HOG WILD with them and just plain slow user productivity to a crawl. |
||||||||
|
|
|||||||
Relocating the "My Documents" folder is not a Roaming profile, profiles remain local just the my documents folder is located on the server. |
||||||||
|
|
|||||||
Quote: NO! Never ever edit the default ADMs. Create your own custom ADMs but leave the defaults as they are. |
||||||||
|
|
|||||||
Quote: LOL!! this never failed me, unless there is a service pack update, but it would be wise to backup your original system.adm, off course you could be as paranoid as Les |
||||||||
|
|
|||||||
One bitten, twice shy. Paranoia is just reality on a finer scale. Unless you specifically turn off the feature, any admin that touches a GPO will replace the ADMs on sysvol if they have newer ones. If you modify an ADM it will have a newer date and it WILL replace every GPO you touch. I had a French admin screw up my GPOs because he modified his ADMs and his French ADMs overwrote mine. When MS updates the ADMs through a newer OS or SP, they too will (may) automagically overwrite your custom ADMs. Laugh if you will at my paranoia but I might have the last laugh. |
||||||||
|
|
|||||||
Quote: Yes I know that but a MANDATORY profile is much like a roaming profile in that it comes from a sever location as well - only the user doesn't get a choice on making any updates to it. I was answering to both statements |
||||||||
|
|
|||||||
OK I am really stuck trying to get my head around this, I have a login script that maps drives depending on service, so if user is part of that security group and the client software is installed locally then the drive is mapped. Say that drive for the application uses drive O:, so my function will add "16384" to the "NoDrives" REG_DWORD within the registry and the drive is now hidden. But say I have another service that also uses drive O:, and I use my function again, it will add "16384" to the "NoDrives" REG_DWORD and I will end up with a total of 32768. I have no error checking within my function, to check if drive O: is aready hidden. Is there a way to convert the "NoDrives" REG_DWORD value into binary. Say drive O: was hidden the binary would be: 00000000000100000000000000. From this I could split the binary into array, and check each drive to see if it was hidden or not. I hope this makes more sence. The binary layout will allways be a 26 bit. Thanks |
||||||||
|
|
|||||||
You don't need to convert to binary - if fact it's not very helpful. Here is one way to do it, the example shows how to set the bits for drive letters M,N and O. The bitwise OR (|) ensures that the bit is set - you cannot set the bit more than once if you use bitwise operators. Code: $dNoDrives=ReadValue(KEY,VALUE) |