I am using the SQLChecker.vbs script to test the databases on an MSSQL server.
The account that is being used in the Credential tab in the Application Group configuration does not have access to the databases in production so will not successfully run the script
I am looking at a way of giving the account rights to the database in the SureBackup job
I have a Domain controller in the SureBackup Job and was hoping to invoke commands in a PSSession from the Veeam Backup server to the DC based on the following script
to add the account to a security group that does have access to the database
Code: Select all
param(
$server = "localhost"
)
$failure = 1
try {
$sess = new-pssession -cn $server -Authentication Negotiate
$hostname = Invoke-Command -Session $sess -ScriptBlock {[system.environment]::MachineName }
Write-Host ("Got result computername {0}" -f $hostname)
#if we got so far that would be nice
Remove-PSSession $sess
$failure = 0
} catch {
write-host ("Failure {0} " -f $error[0])
}
exit $failure
The invoke command works using the .net library in the example but I don't seem to be able to get native PowerShell cmdlets to work
i.e have tried a simple new-item command to create a file in temp but this does not work.
Code: Select all
Invoke-Command -Session $sess -ScriptBlock { New-Item -Path C:\Temp\ -Name SB_test.txt -ItemType file}
Code: Select all
invoke-command -session $sess -ScriptBlock {Param($Radmin,$Rpass) Add-ADGroupMember -Identity SG_DBAs -Members veeamtest -Credential $Radmin $Rpass} -ArgumentList $admin,$pass
My question is has anyone been able to do this or something similar and or is this possible?
am happy to look at other avenues if I'm looking at this the wrong way ?