yup spotted that one pretty early on.
still not getting it to run from the job though. 🙁
SQLPSX_SMOtoCSV.log is empty
SQLPSX_CSVtoDB.log has:
Move-Item : Cannot create a file when that file already exists.
At C:\SQLPSX\Write-SmoCsvToDb.ps1:75 char:10
+ Move-Item <<<< "$CsvDir*.log" "$arcDir$((Get-Date).ToString(`"yyyyMMdd`"))"
Setting the directory C:\SQLPSX\Output\Archive\20081008\ to compress new files [OK]
Compressing files in C:\SQLPSX\Output\Archive\20081008
1 files within 2 directories were compressed.
0 total bytes of data are stored in 0 bytes.
The compression ratio is 1.0 to 1.
SMOCSSVTODB.log file has:
2008-10-08 16:16 processCsv Login
2008-10-08 16:16 processCsv ServerPermission
2008-10-08 16:16 processCsv ServerRole
2008-10-08 16:16 processCsv SqlLinkedServerLogin
2008-10-08 16:16 processCsv SqlUser
2008-10-08 16:16 processCsv DatabasePermission
2008-10-08 16:16 processCsv ObjectPermssion
2008-10-08 16:16 processCsv DatabaseRole
2008-10-08 16:16 archiveCsv C:\SQLPSX\output\20081008
and thats it.
the job completes with success but move zero rows of data.
if i run "./run-smotocsvfile.ps1" it ships the expected data, i then run "./write-smocsvtodb.ps1" and SSRS shows details perfectly.
I cannot run the job step in SQLCmd mode ie:
"!!C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.EXE -command "run-SmoToCsvFile.ps1" >> C:\SQLPSX\SQLJobLog\SqlSec_Err.LOG"
Do I need to give the full location of the run-smotocsvfile.ps1 file? --> c:\sqlpsx\run-smotocsvfile.ps1?
running this from the Command prompt succeeds:
"C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.EXE -command "C:\SQLPSX\run-SmoToCsvFile.ps1"
thanks.