all demo
This commit is contained in:
20
jenkins/1csrv_session.ps1
Normal file
20
jenkins/1csrv_session.ps1
Normal file
@@ -0,0 +1,20 @@
|
||||
$Action=$args[0]
|
||||
$Job=$args[1]
|
||||
Write-Host $Action
|
||||
Write-Host $Job
|
||||
|
||||
$Cred = New-Object System.Management.Automation.PSCredential ('user', (ConvertTo-SecureString 'password' -AsPlainText -Force))
|
||||
|
||||
if ( $Action -match '1CDB')
|
||||
{
|
||||
Invoke-Command -ComputerName 192.16.0.6 -Credential $Cred -Verbose -Authentication Negotiate -ScriptBlock {Remove-Item "D:\1CDB\*.bak"}
|
||||
Invoke-Command -ComputerName 192.16.0.6 -Credential $Cred -Verbose -Authentication Negotiate -ScriptBlock {Backup-SqlDatabase -ServerInstance "." -Database "KD" -BackupFile "D:\1CDB\KD.bak"}
|
||||
Invoke-Command -ComputerName 192.16.0.6 -Credential $Cred -Verbose -Authentication Negotiate -ScriptBlock {Backup-SqlDatabase -ServerInstance "." -Database "IP" -BackupFile "D:\1CDB\IP.bak"}
|
||||
Invoke-Command -ComputerName 192.16.0.6 -Credential $Cred -Authentication Negotiate -ScriptBlock {..\.jenkins\workspace\1csrv_backup\1csrv\1csrv_backup.ps1 $Using:Action}
|
||||
}
|
||||
|
||||
if ( $Action -match 'KD')
|
||||
{
|
||||
Invoke-Command -ComputerName 172.16.0.6 -Credential $Cred -Authentication Negotiate -ScriptBlock {..\.jenkins\workspace\1csrv_backup\1csrv\1csrv_backup.ps1 $Using:Action}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user