|
| 1 | +#Created by EGGSTOASTBACON :: https://github.com/eggstoastbacon |
| 2 | + |
1 | 3 | #SQL MANAGEMENT STUDIO SHOULD BE INSTALLED FROM WHERE YOU RUN THIS
|
2 | 4 | #The server this is run from should have SQL Port and WMI access to the servers you intend to connect to.
|
3 | 5 | #You will require file sqlserver.psd1, change the path to it below.
|
@@ -45,7 +47,6 @@ foreach ($IP in $IPs) {
|
45 | 47 | $sysinfo = Get-WmiObject -computer $IP -credential $wmiCredentials -Class Win32_ComputerSystem -ErrorAction SilentlyContinue
|
46 | 48 | $server = $sysinfo.Name
|
47 | 49 |
|
48 | | - |
49 | 50 | $portCheck = Test-NetConnection -computername $IP -port $SQLPort
|
50 | 51 | if ($portCheck.tcpTestSucceeded -like "True") { $portPassed = "True" }else { write-host "Unable to Connect to $IP on $SQLPort" }
|
51 | 52 |
|
@@ -115,12 +116,10 @@ foreach ($IP in $IPs) {
|
115 | 116 | $userrole = $userrole + "public"
|
116 | 117 | $userrole
|
117 | 118 |
|
118 | | - |
119 | 119 | if ($login.name -notlike "*dbo*" -and $login.name -notlike "sys"`
|
120 | 120 | -and $login.name -notlike "guest" -and $login.name -notlike "*##*"`
|
121 | 121 | -and $login.name -notlike "*MS_*" -and $login.name -notlike "*_SCHEMA*") {
|
122 | 122 |
|
123 | | - |
124 | 123 | #Create an object and write properties about the account
|
125 | 124 | $row = New-Object PSObject
|
126 | 125 | $row | Add-Member -MemberType NoteProperty -Name "Database" -Value "Server Login"
|
@@ -213,4 +212,4 @@ INSERT into $storeTable (IP,CNAME,DB,DOMAIN,LOGIN,CREATED,MODIFIED,LOGINTYPE,SER
|
213 | 212 |
|
214 | 213 | }
|
215 | 214 | }
|
216 | | - |
| 215 | + |
0 commit comments