This commit is contained in:
2024-08-23 16:57:05 +02:00
parent b0d0ede769
commit a0c7d14a63
14 changed files with 935 additions and 141 deletions

View File

@@ -0,0 +1,28 @@
$query=@"
USE [ControlCenter]
DECLARE @res VARCHAR(MAX)=''
SELECT @res = @res + ',"'+[s].[SE_DNS]+'"'
FROM [dbo].[Server] s
JOIN [dbo].[Entity] e ON [e].[EN_id] = [s].[SE_entity]
WHERE e.[EN_id] IN (
1, --sun
2, --ama
21 --cvi
)
AND [s].[SE_DNS] NOT LIKE '%REF____.%'
AND (
s.[SE_end_prod_date] IS NULL
OR s.[SE_end_prod_date] > CURRENT_TIMESTAMP
)
ORDER BY s.[SE_entity], [s].[SE_OU_code];
SELECT STUFF(@res,1,1,'') as OU_list
"@
$machines = Invoke-Sqlcmd -ServerInstance HCIMON -Database ControlCenter -Query $query
$machines | Format-Table