• MadAdmin - Thursday, February 22, 2018 6:54 AM

    using DBATools

    $datatable = Import-Csv C:\temp\customers.csv | Out-DbaDataTable
    Write-DbaDataTable -SqlServer sql2014 -InputObject $datatable -Table mydb.dbo.customers

    Much better than foreach

    Importing data from an existing file is not at all what they are doing though.
    They are getting all services and then for each service, get the service name, status and display name.
    But as the author explained, it's an example for using Invoke-SQLcmd.

    Sue