Hi, I am trying to script some tables and than run the script on one of the instances:
$timestamp = Get-Date -Format yyyy-MM
$TableName = 'My_Table'
# Doing table scripting here
# Output of the script goes into the text file:
$TableScriptFile | out-file "A:\$TableName Staging $timestamp.sql"
This command fails:
Invoke-Sqlcmd -InputFile "A:\$TableName Staging $timestamp.sql"
with the below error message. I can confirm the file exists. It used to work before. Any ideas?
Invoke-Sqlcmd : Could not find a part of the path 'A:\My_Table Staging 2015-06.sql'. At line:1 char:14 + Invoke-Sqlcmd <<<< -InputFile "A:\$TableName Staging $timestamp.sql" + CategoryInfo : InvalidResult: (:) [Invoke-Sqlcmd], DirectoryNotFoundException + FullyQualifiedErrorId : ExecutionFailed,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
At the risk of asking something stupid, is there an actual A: drive on your computer?
Powered by IDERA