Script to deny access to this computer over the network - Windows

Tarley Rodrigues 1 Reputation point
2022-10-04T20:22:35.83+00:00

For a college study, I need to study ways to create a script to deny computer access, which is done by going into:

"run: gpedit.msc"
Computer Configuration
Windows Settings
Security Settings
Local Policies
User Rights Assignment
Deny access to this computer from the network
Add user or group and add the users you want to block

I can't find materials or script examples to modify things in gpedit.msc, any help would be grateful

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,588 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,481 Reputation points
    2022-10-04T22:20:28.75+00:00

    Have a look at this, and the PolicyFileEditor module: Local-gpo-powershell

    0 comments No comments

  2. Limitless Technology 44,531 Reputation points
    2022-10-11T14:50:33.353+00:00

    Hello there,

    This security setting determines which users are prevented from accessing a device over the network.

    Constant: SeDenyNetworkLogonRight

    Settings are applied in the following order through a Group Policy Object (GPO), which will overwrite settings on the local computer at the next Group Policy update:

    Local policy settings
    Site policy settings
    Domain policy settings
    OU policy settings
    When a local setting is greyed out, it indicates that a GPO currently controls that setting

    More info here https://zcusa.951200.xyz/en-us/windows/security/threat-protection/security-policy-settings/deny-access-to-this-computer-from-the-network

    ----------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.