File tree Expand file tree Collapse file tree 1 file changed +28
-22
lines changed Expand file tree Collapse file tree 1 file changed +28
-22
lines changed Original file line number Diff line number Diff line change @@ -15165,29 +15165,35 @@ Function Get-SQLServerLoginDefaultPw
15165
15165
return
15166
15166
}
15167
15167
15168
- # Grab username and password
15169
- $CurrentUsername = $TblResultsTemp.username
15170
- $CurrentPassword = $TblResultsTemp.password
15171
-
15172
15168
# Test login
15173
- $LoginTest = Get-SQLServerInfo -Instance $instance -Username $CurrentUsername -Password $CurrentPassword -SuppressVerbose
15174
- if($LoginTest){
15175
-
15176
- Write-Verbose "$Instance : Confirmed default credentials - $CurrentUsername/$CurrentPassword"
15177
-
15178
- $SysadminStatus = $LoginTest | select IsSysadmin -ExpandProperty IsSysadmin
15179
-
15180
- # Append if successful
15181
- $TblResults.Rows.Add(
15182
- $ComputerName,
15183
- $Instance,
15184
- $CurrentUsername,
15185
- $CurrentPassword,
15186
- $SysadminStatus
15187
- ) | Out-Null
15188
- }else{
15189
- Write-Verbose "$Instance : No credential matches were found."
15190
- }
15169
+ #Write-Verbose ($instance).ToString()
15170
+ #Write-Verbose ($CurrentUsername).ToString()
15171
+ #Write-Verbose ($CurrentPassword).ToString()
15172
+
15173
+ # Grab and iterate username and password
15174
+ for($i=0; $i -lt $TblResultsTemp.count; $i++){
15175
+ #Write-Verbose $TblResultsTemp
15176
+ $CurrentUsername = $TblResultsTemp.username[$i]
15177
+ $CurrentPassword = $TblResultsTemp.password[$i]
15178
+ $LoginTest = Get-SQLServerInfo -Instance $instance -Username $CurrentUsername -Password $CurrentPassword -SuppressVerbose
15179
+ if($LoginTest){
15180
+
15181
+ Write-Verbose "$Instance : Confirmed default credentials - $CurrentUsername/$CurrentPassword"
15182
+
15183
+ $SysadminStatus = $LoginTest | select IsSysadmin -ExpandProperty IsSysadmin
15184
+
15185
+ # Append if successful
15186
+ $TblResults.Rows.Add(
15187
+ $ComputerName,
15188
+ $Instance,
15189
+ $CurrentUsername,
15190
+ $CurrentPassword,
15191
+ $SysadminStatus
15192
+ ) | Out-Null
15193
+ }else{
15194
+ Write-Verbose "$Instance : No credential matches were found."
15195
+ }
15196
+ }
15191
15197
}
15192
15198
15193
15199
End
You can’t perform that action at this time.
0 commit comments