Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7043899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:20:43+00:00 2026-05-28T02:20:43+00:00

I’m working on a program that will disable access to shared folders on a

  • 0

I’m working on a program that will disable access to shared folders on a document server if the hard drive is getting close to being full. Currently, I am just renaming them to something different to prevent the app server from being able to send more documents over. I’m wondering if there is a way to somehow lock down a folder programmatically, either setting it to read only, or disable its share status. From what I’ve seen, changing a folder to read-only directly in windows doesn’t prevent new files from being copied into it. Anyone have any ideas on how to do this? My current code looks like this:

Private Function MoveShares(ByVal strOldLocation As String, ByVal strNewLocation As String) As Boolean

    Dim objFSO As New FileSystemObject
    If objFSO.FolderExists(strOldLocation) Then
        LogAction "Moving " & strOldLocation & " to " & strNewLocation
        objFSO.MoveFolder strOldLocation, strNewLocation
    End If
    Set objFSO = Nothing

End Function

Pretty basic, but I’m hoping I can do this in a subtler way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:20:44+00:00Added an answer on May 28, 2026 at 2:20 am

    For the shared folder, I ended up editing the registry to “rename” the share itself, not the folder. I did this by reading the registry entry data, deleting the entry, and writing the data to a new entry. I also had to restart the computer browser and server services in order for the server to acquire the new share name. This prevents the app server from sending documents because it can’t find a share with the old name. I also had to convert the security entry values from decimal back to hexadecimal before writing them to the new entry, and wait between stopping and restarting services to make sure they had finished before moving on the to next service.

    Private Function RenameShare(ByVal strOldName As String, ByVal strNewName As String) As Boolean
    
    Dim objRegAccess As Object
    Dim varValues() As Variant
    Dim varItem As Variant
    Dim strSharePath As String
    Dim strSecurityPath As String
    Dim strValues As String
    Dim strCmd As String
    
    Set objRegAccess = CreateObject("Wscript.Shell")
    strSharePath = "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Shares\"
    strSecurityPath = strSharePath & "Security\"
    strValues = ""
    varValues = objRegAccess.RegRead(strSharePath & strOldName)
    strValues = ""
    For Each varItem In varValues
        strValues = strValues & varItem & "~"
    Next
    RunCommand "REG ADD " & strSharePath & " /v " & strNewName & " /t REG_MULTI_SZ /s ~ /d " & strValues & " /f", False
    RunCommand "REG DELETE " & strSharePath & " /v " & strOldName & " /f", False
    strValues = ""
    varValues = objRegAccess.RegRead(strSecurityPath & strOldName)
    For Each varItem In varValues
        strValues = strValues & varItem & "~"
    Next
    strValues = ConvertDecToHex(strValues)
    RunCommand "REG ADD " & strSecurityPath & " /v " & strNewName & " /t REG_BINARY /d " & strValues & " /f", False
    RunCommand "REG DELETE " & strSecurityPath & " /v " & strOldName & " /f", False
    RunCommand "NET STOP ""Computer Browser"" ", True
    RunCommand "NET STOP ""Server"" ", True
    RunCommand "NET START ""Server"" ", True
    RunCommand "NET START ""Computer Browser"" ", False
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm trying to create an if statement in PHP that prevents a single post
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.