replace the result of a list with the result of a select query

  • Hello everyone

    I need to replace a predefined list by the result of a select query

    my list is statistically defined 
    $path=@("\\Filer1\sql-bck$","\\filer2\sql-bck$\",","\\filer3\sql-bck$\" )  and I want to replace this list with the result of a select query $path=select filer from piste

    ci joint mon code $date=get-date
    $Header = @"
    <style>
    TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
    TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
    </style>
    "@
    $path=@("\\Filer1\sql-bck$","\\filer2\sql-bck$\",","\\filer2\sql-bck$\" )
    [string]$liste=Get-ChildItem -path $path -Recurse -File |select Name ,length ,lastwriteTime,fullname |where-object  {$_.LastWriteTime -lt $date.AddYears(-1)} |sort-object lastwriteTime | ConvertTo-Html -Head $Header
    $smptServer = 'smtp.armatis.corp'
    $to = 'Abdallah.MEHDOINI@gmail.com'
    $from = 'Abdallah.MEHDOINI@gmail.com'
    $subject = 'GDPR/365'
    Send-MailMessage -To $to -From $from -Body $liste -BodyAsHtml -SmtpServer $smptServer -Subject $subject

    Thank you for your help

    by the result of a select query

  • You have expressed a requirement, but not asked a question. What would you like help with, exactly?

    Please provide consumable DDL, sample data and desired results so that people can try to assist, assuming you are looking for T-SQL assistance.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply