-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discover-MSSQLServers suggestions #1
Comments
Thanks for the feedback! I am not a developer, more of a PowerShell enthusiast & hacker (to use the original definition) and , obviously, not used to writing complete scripts and not just functions. ☺ Good call on the write-output. That was more of a testing artifact than anything else. I will remove it in the next update (along with the sorting/grouping options). I have a pretty substantial lab at home which I tested against while coding the scripts and will run against a couple of customer environments this week to determine true performance (one is a single domain, single forest and another is a multiple domain, single forest). Comparing run-time with ExtendedInfo and without will help determine if it’s significant. I’ll get the other scripts updated in similar fashion to the comments you provided on this one as I’m sure they’re applicable. I look forward to your (and Chris’) feedback on the other scripts as well (the ADInfo one is still a work in progress – still determining desired output on that one). From: Matt Graeber [mailto:[email protected]]
· When creating custom object, creating a hastable of properties and adding them to a PSObject seems to be the unofficial best practice. New-Object -TypeName PSObject -Property $ObjectProperties Otherwise, everything looks good! Now, I don't have a domain environment in which I can test this but perhaps @obsuresec does. Nice work! -Matt — |
Replying to twitter DM on email for content reasons. "Awesome! I still think you should use a custom object though instead of outputting an array of objects in $ALLSQLServerReport :)" I thought I had used a custom object as per http://technet.microsoft.com/en-us/library/ff730946.aspx (second link in the PowerSploit style guide) " $colAverages = @() foreach ($objBatter in $colStats) I did restructure it as you suggested below, but couldn't figure out the proper looping to merge the data in an object, so I altered it to better match the above. I am always open to better methods. :) Due to some testing today, I am dumping "ExtendedInfo" for now. I am also changing the processing for the Interesting Services. Thanks for the feedback. This project is helping me expand my ADSI knowledge as well as PowerShell optimization. Cheers, Sean [email protected] (personal) [email protected] (work) From: Sean Metcalf Thanks for the feedback! I am not a developer, more of a PowerShell enthusiast & hacker (to use the original definition) and , obviously, not used to writing complete scripts and not just functions. :) Good call on the write-output. That was more of a testing artifact than anything else. I will remove it in the next update (along with the sorting/grouping options). I have a pretty substantial lab at home which I tested against while coding the scripts and will run against a couple of customer environments this week to determine true performance (one is a single domain, single forest and another is a multiple domain, single forest). Comparing run-time with ExtendedInfo and without will help determine if it's significant. I'll get the other scripts updated in similar fashion to the comments you provided on this one as I'm sure they're applicable. I look forward to your (and Chris') feedback on the other scripts as well (the ADInfo one is still a work in progress - still determining desired output on that one). From: Matt Graeber [mailto:[email protected]]
· When creating custom object, creating a hastable of properties and adding them to a PSObject seems to be the unofficial best practice. New-Object -TypeName PSObject -Property $ObjectProperties Otherwise, everything looks good! Now, I don't have a domain environment in which I can test this but perhaps @obsuresec does. Nice work! -Matt Reply to this email directly or view it on GitHubhttps://github.com//issues/1. |
Rename 'function Discover-MSSQLServers.ps1' to 'function Discover-MSSQLServers'
Remove the GroupResults and SortResults functionality. You should only output object and let the user figure out what to do with the raw output.
Is there a distinct performance hit when -ExtendedInfo is provided? If not, remove the -ExtendedInfo switch and just query those properties by default. Ideally, a function shouldn't output more than one type of object.
Only output objects! The following line is the equivalent of Write-Host and is unnecessary:
Write-Output "Discovered $AllMSSQLServerFQDNsCount servers running MS SQL `r "
When creating custom object, creating a hastable of properties and adding them to a PSObject seems to be the unofficial best practice.
e.g.
$ObjectProperties = @{
Prop1 = 1
Prop2 = 2
}
New-Object -TypeName PSObject -Property $ObjectProperties
Otherwise, everything looks good! Now, I don't have a domain environment in which I can test this but perhaps @obsuresec does. Nice work!
-Matt
The text was updated successfully, but these errors were encountered: