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
Post a Comment