locked
Script to prohibit special characters RRS feed

  • Question

  • Hello,

    I would like create a script to prohibit special characters when creating a folder.

    For exemple :

    An user create a folder with as characters !TEST. I would like the script to block creation because there is "!" in the begining.

    Is it possible to create this script ?

    Thanks you in advance for your answer.

    Regards

    Pauline

    Monday, March 27, 2017 8:03 AM

Answers

  • Windows servers have a file name enforcement mechanism FSRM.  You can create a rule that controls type of file ad a naming convention.  On a workstation there is no way to prevent a user from   using any name they can type.  I force all users folders to the server with GP and then use the file monitor to enforce file rules.

    See this: http://windowsitpro.com/windows-server-2012/windows-server-2012-fci

    Your boss will think you are a genius and he will give you a raise just don't tell him how you did it.


    \_(ツ)_/

    Thursday, March 30, 2017 5:49 PM

All replies

  • Yes.  I suggest that you start by learning how to use PowerShell.


    \_(ツ)_/

    • Proposed as answer by The Grim Monday, March 27, 2017 4:59 PM
    Monday, March 27, 2017 8:22 AM
  • Hi,

    I have already used Powershell but I can not finds tracks to start the script.

    Have you a site which can help me ?

    Regards

    Pauline

    Monday, March 27, 2017 8:56 AM
  • Just use  "-match"  to detect your list of bad characters.

    \_(ツ)_/

    Monday, March 27, 2017 12:08 PM
  • What is the purpose of doing this?

    -- Bill Stewart [Bill_Stewart]

    Monday, March 27, 2017 4:56 PM
  • The interest is that an user can not create a folder with the character ! at the beginning
    Wednesday, March 29, 2017 1:51 PM
  • The interest is that an user can not create a folder with the character ! at the beginning

    Why?


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 29, 2017 2:10 PM
  • It's my boss which ask me. For a matter of cleaning a folder and putting rules to all users.

    I still do not find how to do it

    Thursday, March 30, 2017 8:40 AM
  • Tell your boss that he need to hire a competent consultant to do what he asks.  Yu are not trained as a programmer or technician and he should not require you to do this. You have not been trained in Windows or computer technologies.

    \_(ツ)_/

    Thursday, March 30, 2017 8:49 AM
  • "My boss said so" does not really answer the "why" question.

    I don't think we're going to be able to help you do whatever it is your boss thinks needs to be done.


    -- Bill Stewart [Bill_Stewart]

    Thursday, March 30, 2017 2:21 PM
  • Windows servers have a file name enforcement mechanism FSRM.  You can create a rule that controls type of file ad a naming convention.  On a workstation there is no way to prevent a user from   using any name they can type.  I force all users folders to the server with GP and then use the file monitor to enforce file rules.

    See this: http://windowsitpro.com/windows-server-2012/windows-server-2012-fci

    Your boss will think you are a genius and he will give you a raise just don't tell him how you did it.


    \_(ツ)_/

    Thursday, March 30, 2017 5:49 PM
  • The only way to do that is to create something which is keep working with running timer every millisecond to check any new created folder and then take an action. You can do that by creating a Windows Service with Microsoft .Net.

    But such service would be an overload on the server for really a weird task. Are you really sure you need to do such thing?

    If you really still want to go with that approach, you need a good .Net Developer to support you.

    Thursday, March 30, 2017 6:00 PM