i just found this for powershell:
http://stackoverflow.com/questions/3891952/sql-server-script-data-smo-scripter-not-working-when-output-to-file
for doing it via TSQL, i've used a script by Narayana Vyas Kondreddi for years and years:
http://vyaskn.tripod.com/code.htm#inserts
there's a few parameters that need to be changed to varchar(max) if you trip over some errors, but it's a really great effort.
Lowell
--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!