Blog Post

Tidier PowerShell Scripts with Default Parameter Values

,

I was recently working on a PowerShell script to set up some new databases for my users and found myself writing the same things over and over again.

1 2 3 Invoke-DbaQuery -SqlInstance MyServer -Database $SrcDB -Query "select field1 from table..."; Invoke-DbaQuery -SqlInstance MyServer -Database $DstDB -Query "update table..."; Invoke-DbaQuery -SqlInstance MyServer -Database $DstDB -Query "insert into table..."; By the 4th Invoke-DbaQuery, I found myself thinking “this repetitive typing kind of sucks.

Original post (opens in new tab)

Rate

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

Share

Share

Rate

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating