• erikd (6/25/2013)


    For the simple file move, I agree with you. But I'm doing a bit more than that with the file name as a variable. I'm not sure I could easily do that with PS.

    So like, where I insert the file name into the Schema.ini file, or email the file name... Yeah. Not sure about those things with your method.

    Use Out-File to write a new file with PowerShell.

    One of PowerShell's strengths is its help system. If you learn to use the help, you can learn how to script in PowerShell in a hurry. At a PowerShell prompt type

    help Out-File

    or

    help Out-File -Examples

    to see how to use Out-File.

    To send an email with PowerShell, if you like the audit trail Database Mail offers you can connect to your database and execute sp_send_dbmail using Invoke-SqlCmd. Or you can skip the database dependency completely and add a function to your script to send an email directly out of PowerShell, like this: http://blogs.msdn.com/b/rkramesh/archive/2012/03/16/sending-email-using-powershell-script.aspx

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato