How to disable administrative shares on Windows 8.1 (PowerShell) 

 

Introduction

This script sample can disable administrative shares on Windows 8.1.

 

Scenarios 

In general, users are told not to disable Administrative Share, because several potential issues may occur. But some users still choose to disable Administrative Share for anyone with administrative access to local computer or domain can access your whole C, D or other partitions. This script will help users easily disable Administrative Share. 

Step 1: Start the PowerShell Console with administrator. To run the script in the Windows PowerShell Console, type the command< Script Path> at the Windows PowerShell Console.

 

When the script finishes running, it will show a brief message as shown below:

 

Here are some code snippets for your reference.

PowerShell
Edit|Remove
How to disable administrative shares on Windows 8.1 (PowerShell) 
 
Introduction 
This script sample can disable administrative shares on Windows 8.1. 
 
Scenarios 
In general, users are told not to disable Administrative Share, because several potential issues may occur. But some users still choose to disable Administrative Share for anyone with administrative access to local computer or domain can access your whole C, D or other partitions. This script will help users easily disable Administrative Share. 
Step 1: Start the PowerShell Console with administrator. To run the script in the Windows PowerShell Console, type the command< Script Path> at the Windows PowerShell Console.  
  
When the script finishes running, it will show a brief message as shown below: 
  
Here are some code snippets for your reference. 
- PowerShell code snippet - 
 
If($DisableAdminShares -eq $null) 
{ 
    Try 
    { 
        New-ItemProperty -Path $KeyPath -Name "AutoShareWKS" -Value 0 -PropertyType DWord | Out-Null 
        Write-Host "Disabled administrative shares successfully." -ForegroundColor Green 
        #Invoke prompt message 
        Get-Choice 
    } 
    Catch 
    { 
        Write-Host "Failed to disable administrative shares." -ForegroundColor Red 
    } 
} 
 
- end - 
 
 
Prerequisite 
Windows 8 or higher version 
 

 

Prerequisite

Windows 8 or higher version