• Useful, but I'd avoid using the args[] variable and do it "the Powershell way" with a Param block at the start of the script, that way you get things like autocomplete for free and named arguments, as well as getting guarantees that mandatory parameters have to be supplied.

    param(

    [Parameter(Mandatory=$true, HelpMessage='Enter name of server')]

    [String]$ServerName,

    [Parameter(Mandatory=$true, HelpMessage='Enter the name of the database')]

    [String]$Database,

    [Parameter(Mandatory=$true, HelpMessage='Enter the path to the source file')]

    [String]$Sourcefile

    )