Delete All Files and Folders Under a Folder
Very simple to do with Powershell, Open a powershell command prompt and type:
Remove-Item c:\DirYouWantToDelete\* -recurse -force
Very simple to do with Powershell, Open a powershell command prompt and type:
Remove-Item c:\DirYouWantToDelete\* -recurse -force
Below is a small powershell script that will add the “Everyone” Group to Full control for a the registry key HKEY_LOCAL_MACHINE\Software\MyKey. This script will then recursively change the permission on SubKeys and future keys. Save the text to a notepad document and call it something like RegPermissions.ps1
$acl = Get-Acl HKLM:\Software\MyKey
# Everyone has Full contol may do anything: $person = [System.Security.Principal.NTAccount]"Everyone" $access = [System.Security.AccessControl.RegistryRights]"FullControl" $inheritance = [System.Security.AccessControl.InheritanceFlags]"ObjectInherit,ContainerInherit" $propagation = [System.Security.AccessControl.PropagationFlags]"None" $type = [System.Security.AccessControl.AccessControlType]"Allow" $rule = New-Object System.Security.AccessControl.RegistryAccessRule($person,$access,$inheritance,$propagation,$type) $acl.ResetAccessRule($rule) Set-Acl HKLM:\Software\MyKey $acl
To run the program from a login script you can assign it to the computer and run using the following syntax:
powershell -executionpolicy bypass -File \\Server\Share\RegPermissions.ps1
When you try and add another USB external drive to windows backup you get the following error “ The filename, directory name, or volume label syntax is incorrect”.
This message occurs if you have another drive currently assigned to the backup and it is NOT currently accessible. eg. its offsite or you only have one dock attached to the server. To add another disk and get around this error do the following:
1. Open an Administrative Command Prompt
2. Run ‘wbadmin get disks‘
3. In the output of this message locate the external USB drive you want to add to the backup set. The format of the output will be something like:
Disk name: xxxxxxxxxxx
Disk number: x
Disk identifier: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
Total space: xxx.xx GB
Used space : xxx.xx GB
4. Run the following command copying the Disk Identifier from step 3 at the end of the command:
WBADMIN ENABLE BACKUP -addtarget:{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
5. Answer yes to the prompts.