In: Computer Science
POWERSHELL
Remember hidden administrative shares that are automatically created for all disk drives in Windows operating systems (C$, D$, etc.)? These shares can be stopped and removed, but after the next reboot, the shares will reappear. There is a registry key that can be created to remove these permanently; refer to the Microsoft KB #954422 article for the appropriate registry key/value. Create a script that will:
A. Check if the registry key exists.
B. If the key exists, change the value to the appropriate value.
C. If the key does not exist, create the key and add the new value.
D. Insert screen feedback to inform the user of the progress of the script (use write-host).
Use msconfig and add the PowerShell script to startup, but I cannot find the PowerShell script on that list.
Create a shortcut and drop it to startup folder. No luck.
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -File "C:\script.ps1"
or
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File "C:\script.ps1"
script.ps1
************
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\LanManServer' -Name 'AutoShareWks' -PropertyType 'Dword' -Value 0
put above script.ps1 file in the c:\script\script.ps1 and add entry to the startup folder so each time when the computer start it will execute this script with administrator rights so it will set the registry value to 0 each time automatically.
if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)