18 lines
845 B
PowerShell
18 lines
845 B
PowerShell
|
|
switch ($env:computername) {
|
|
"ITDWINAUTOT1" {
|
|
New-UDTypography -Text 'NPD'
|
|
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
|
$Database = "ITD-Systems-Automation"
|
|
$Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_PRD"
|
|
}
|
|
"ITDWINAUTOP1" {
|
|
New-UDTypography -Text 'PRD'
|
|
$ServerInstance = "itdintsql22p1.nd.gov\INTSQL22P1"
|
|
$Database = "ITD-Systems-Automation"
|
|
$Table = "Infra_WindowsServer_FileManagement_RemoveITDExpiredFiles_PRD"
|
|
}
|
|
}
|
|
|
|
$SqlQuery = "SELECT [PSUJobId],[DateTime],[ComputerName],[Status],[FullName] FROM [$Database].[dbo].[$Table]"
|
|
$SqlRecords = Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $SqlQuery -Credential $Secret:sql_itdpsu1 -Verbose |