Skip to main content

Send a powershell object straight to SQL Server


Recently I needed to copy directory contents details to an SQL Server.

This is the powershell script I used to do it.



$path = "C:\Files\"

$Table  = Get-ChildItem -Path $path |  Select-Object Name , FullName , CreationTime , Length

Write-SqlTableData -ServerInstance "PBRUCE-DT" -DatabaseName "PlayDatabase" -SchemaName "dbo" -TableName "FileInfoArchive" -InputData $Table  -Force

Comments

Popular posts from this blog