Advertisement
tankcr

CheckDB

Sep 4th, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $DBName = $wfcatalog
  2. ([string]$sqlServer, [string]$DBName)
  3. $wfexists = $FALSE
  4. try
  5. {
  6.     $conn = New-Object system.Data.SqlClient.SqlConnection
  7.     $conn.connectionstring = [string]::format("Server={0};Database={1};Integrated Security=SSPI;",$sqlServer,$DBName)
  8.     $conn.open()
  9.     $wfexists = $true
  10. }
  11.     catch
  12. {
  13.         Write-Log -type Info "DB $DBNAME on $sqlServer does not exist continuing with install"
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement