I have tried every recommendation from the link below, but nothing works.
How do you do a ‘Pause’ with PowerShell 2.0?
Here is my code:
Read-Host -Prompt "Press Enter to continue"
Invoke-Sqlcmd -Query "Select * from TBL_AGG_BOC" -ServerInstance "server_name\SQL2008" -Database "db_name" > "C:\Users\TBL_AGG_BOC.txt"
Read-Host -Prompt "Press Enter to continue"
The script keeps failing, and it shuts down so fast that I can't see what is actually happening. How can I force this to stay open for a few seconds so I can see what is happening here?
The file is saved and named 'test_export.ps1'
, and I right-click the file and then click 'Run with PowerShell'
to fire it off. I don't have administrator rights on this machine. I hope that's not a problem.