I'm trying to upload tons of data stored in .csv files to remote MSSQL.
I found working solution (at least for syncronous mode) here.
I'm trying to start part with asyncronous mode via Powershell jobs, but it's failing.
Here is code:
Get-ChildItem "G:\Data\*.csv" | % {
Start-job -Name "$($_)" -InitializationScript {Ipmo Functions -Force -DisableNameChecking} `
-ScriptBlock { $DataImport = Import-Csv -Path $args[0]
$DataTable = Out-DataTable -InputObject $DataImport
Write-DataTable -ServerInstance "MSSQL" `
-Database "database" `
-TableName "table" `
-Username "user" `
-Password "pwd" `
-Data $DataTable
} -ArgumentList $_.fullname}
I receive error:
Ipmo : The specified module 'Functions' was not loaded because no valid module file was found in any module directory. At line:1 char:1 + Ipmo Functions -Force -DisableNameChecking + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (Functions:String) [Import-Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Could anyone please help?