Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to schedule vCheck for multiple vCenters in single job? #752

Open
Srikanth1455 opened this issue Feb 2, 2023 · 1 comment
Open

How to schedule vCheck for multiple vCenters in single job? #752

Srikanth1455 opened this issue Feb 2, 2023 · 1 comment

Comments

@Srikanth1455
Copy link

  1. How to run vCheck on multiple vCenters
  2. How to merge all vCenters output in single HTML file?
@junk430
Copy link

junk430 commented May 21, 2024

Might not be everything you are looking for but we've got 4-5 locations and someone wrote this script to search sub dir's for vCheck.ps1 and run it. So put a vCheck_USA, vCheck_France directory under the script.

$strSMTP = "eemail.home.now"
$strFrom = "yourcomputer@home.now"
$arTo = @("me@home.now")
$strSubject = "vCheck Reports"
$strMessage = "See attached vCheck Reports"

$ScriptPath = (Split-Path ((Get-Variable MyInvocation).Value).MyCommand.Path)

$ScriptInstances = Get-ChildItem -Path $ScriptPath -Filter vcheck.ps1 -Recurse
Remove-Item -Path "$ScriptPath\Output*" -Recurse
Foreach ($instance in $ScriptInstances)
{
$command = $instance.FullName + " –OutputPath $ScriptPath\Output"
Invoke-Expression -Command $command
}

$outputHTM = Get-ChildItem -Path "$ScriptPath\OutPut" -Filter *.htm -Recurse
$arAttachments = @()
Foreach ($htm in $outputHTM)
{
$arTemp = $htm.BaseName.Split(".")
$newFileName = $arTemp[0] + ".htm"
Rename-Item $htm.FullName $newfileName
$newfileName = $htm.DirectoryName + "" + $newFileName
$arAttachments += $newFileName
}

send-mailmessage -SmtpServer $strSMTP -From $strFrom -To $arTo -Subject $strSubject -Body $strMessage -Attachments $arAttachments

#Clean up
Remove-Item -Path "$ScriptPath\Output*" -Recurse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants