Added new scripts and changes

This commit is contained in:
2024-12-24 15:33:41 +01:00
parent a0c7d14a63
commit 9052475370
18 changed files with 11313 additions and 7 deletions

View File

@@ -1,10 +1,15 @@
[CmdletBinding()]
param (
[Parameter(Position=1, Mandatory=$true)]
[string]
$machineName
)
$query=@"
USE [ControlCenter]
DECLARE @res VARCHAR(MAX)=''
SELECT @res = @res + ',"'+[s].[SE_DNS]+'"'
SELECT [s].[SE_DNS]
FROM [dbo].[Server] s
JOIN [dbo].[Entity] e ON [e].[EN_id] = [s].[SE_entity]
WHERE e.[EN_id] IN (
@@ -19,10 +24,16 @@ AND (
)
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 = Invoke-Sqlcmd -ServerInstance HCIMON -Database ControlCenter -Query $query -TrustServerCertificate
$machines | Format-Table
$machines | Select-Object -First 3 | ForEach-Object {
$trg = $_
$files = Get-ChildItem -Path "\\$_\c$" -Filter "*vesta*"
$files += Get-ChildItem -Path "\\$_\d$" -Filter "*vesta*"
$files += Get-ChildItem -Path "\\$_\f$" -Filter "*vesta*"
$files += Get-ChildItem -Path "\\$_\u$" -Filter "*vesta*"
}