Workaround: ‘sqlps’ and "Test-Path" PowerShell cmdlet on a UNC path

Related Forum thread: http://social.msdn.microsoft.com/Forums/en-US/sqlsmoanddmo/thread/719ede23-9f1a-43f5-8c4e-8188fea0b19f/ Related Connect feedback: https://connect.microsoft.com/SQLServer/feedback/details/768743/sql-server-2012-import-module-sqlps-breaks-the-test-path-powershell-cmdlet Issue:When Test-Path cmdlet is run in SQL Powershell from the context of SQL Powershell provider path, Test-Path returns False. We see the same behavior with Registry Window Powershell provider as well Workaround:Specify literal path while using Test-Path cmdletExample:test-path -literalpath “FileSystem::\\machine\uncpath” References:http://mcpmag.com/articles/2011/05/16/handling-errors-scripts-test-path.aspxhttp://msdn.microsoft.com/en-us/library/windows/desktop/ee126188(v=vs.85).aspx

1

Powershell script to run query against many servers and send combined output as email

Sample code to run query against multiple SQL Servers and export the combined output to Excel. This generated excel file is later sent as email attachment using hotmail. Related email thread: http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/987d48c0-a82d-4424-8699-cdd0b2bc9c51   http://sethusrinivasan.wordpress.com/2012/01/11/powershell-script-to-run-query-against-many-servers-and-send-combined-output-as-email/   This posting is provided “AS IS” with no warranties, and confers no rights. Use of included script samples are subject…

1