Monthly archives: September 2006

Timothy

Administrative Template to Restrict Write Access to Removable Drives

Looking for a way to restrict access to removable drives in your domain on your workstations?  It's easier than you might think!  There is a registry setting you can set that will turn all removable drives into read-only devices.  This includes USB thumb drives, hard drives, and even CD/DVD writers.  Of course editing the registry is a pain in the butt if you have a domain with dozens or hundreds of workstations, so I created this Administrative Template for use in Group Policy to configure this setting for you. 

Unfortunately, Microsoft did not store these settings in the "true policy" locations of the registry, so in the GPEDIT.MSC you need to click on Administrative Templates, then select View -> Filtering...  Uncheck "Only show policy settings that can be fully managed."  This will allow you to see the "preferences."  (Policy settings that are not fully managed are called Preferences.)  You can google for more information on the differences between policies and preferences. 

Enjoy!

Microsoft's explanation of Administrative Templates...
http://technet2.microsoft.com/WindowsServer/en/Library/8f0daf74-1eac-4d47-ac8a-bcbe23c673521033.mspx

Link to the Remove Storage Device administrative template...
http://www.avianwaves.com/tech/tools/RemovableStorageDevice_ADM

Timothy

Recursively setting attributes on NTFS files in VB.NET made easy

One thing I love about the new VB.NET in Visual Studio 2005 is the “My” namespace, which offers tons of useful code for common tasks in a single easy to find namespace.  As good as the My.Computer.FileSystem namespace is, however, it is lacking a way to easily change attributes on files. 

I needed to recursively remove all Read-Only and Hidden attributes in a folder hierarchy in order to copy over (write over) those files using the My.Computer.FileSystem.CopyDirectory method.  This method will throw an exception if a file is marked as Read-Only.  So, I wrote the following code segment to remove the Read-Only and Hidden attributes for me.  Of course this can be easily modified to set other attributes too.

Public Sub RemoveReadOnlyAttributes(ByVal folder As String)
  ' Remove attribute on individual files
  For Each filename As String In My.Computer.FileSystem.GetFiles(folder)
    System.IO.File.SetAttributes(filename, IO.FileAttributes.Normal)
  Next

  ' Recursively call this routine on all subfolders
  For Each foldername As String In My.Computer.FileSystem.GetDirectories(folder)
    RemoveReadOnlyAttributes(foldername)
  Next
End Sub

Blog

Search Posts

Recent Comments

  1. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Brian: Thank you so much Edward! :-)

  2. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Tom: Thank you Edward! After beating my head against a wall for days, tried your suggestion out and lo and...

  3. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Mike: DPM 2016 setup will fail if you have SQL Server Management Studio (SSMS) V17.x installed. Re-Install...

  4. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Rob: Edward, thanks man! you were a lifesaver. My scenario was Win Server 2016 from scratch, SQL 2016 (N...

  5. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Edward: It also crashes with the 4387 error if you have the SQL Management Studio 17 tools installed. Installing...

  6. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Ram: Hi - I followed richsmif instruction and was able to successfully install DPM 2016 on SQL 2016. Completed...

  7. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Neighborgeek: Thanks for the post, this is exactly the issue I am running into. I'm disappointed to see that you didn...

  8. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    richsmif: I have DPM 16 working with SQL 16. Install SQL 16 first, don't touch, install DPM 16 , upgrade to ...

  9. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: That should have been *ID 810*, not 820

  10. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: For anyone else coming across this in the future and have an ID 820 error: For some strange reason...

Archive

Tag Cloud