Update AdHoc-Backup.ps1
This commit is contained in:
parent
500aa81ce2
commit
b626f78b3a
@ -473,12 +473,12 @@ function Backup-SqlDatabases {
|
||||
|
||||
# --- PRE-FLIGHT: Concedi a NT AUTHORITY\SYSTEM il permesso server-level 'BACKUP ANY DATABASE' ---
|
||||
try {
|
||||
$sqlGrant = @"
|
||||
$sqlGrant = @'
|
||||
USE master;
|
||||
IF NOT EXISTS (SELECT 1 FROM sys.server_principals WHERE name = N'NT AUTHORITY\SYSTEM')
|
||||
CREATE LOGIN [NT AUTHORITY\SYSTEM] FROM WINDOWS;
|
||||
GRANT BACKUP ANY DATABASE TO [NT AUTHORITY\SYSTEM];
|
||||
"@
|
||||
'@
|
||||
$tmpGrant = Join-Path $Paths.SqlStage "grant_SYSTEM_server.sql"
|
||||
$sqlGrant | Out-File -LiteralPath $tmpGrant -Encoding ASCII -Force
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user