Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The script should be shceudled on a domain controller and run using the (system) account.
- Import-Module ServerManager
- [string]$date = get-date -f 'yyyy-MM-dd'
- # \\FileServer\ADBackup$ represent your remote hidden share. Ignore the "AD-$date" part as the script will create it for you
- $TargetUNC = "\\FileServer\ADBackup$\AD-$date"
- If ( Test-Path $TargetUNC) { Remove-Item -Path $TargetUNC -Recurse -Force }
- # (Domain Controllers) built in AD group should have full NTFS and share rights on the remote hidden share \\FileServer\ADBackup$
- New-Item -ItemType Directory -Force -Path $TargetUNC
- #Make sure you create a user in your domain (myuser) that have write share and NTFS permission on the hidden share folder
- $WBadmin_cmd = "wbadmin.exe START BACKUP -backupTarget:$TargetUNC -systemState -noverify -vssCopy -quiet -user:Myuser -password:MyPassword "
- Invoke-Expression $WBadmin_cmd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement