Closed wsmelton closed 6 years ago
I like! Can you add more stuff? Perhaps using what @SQLDBAWithABeard created within dbareports.
I've attempted one of these before and faced so much scope creep it exhausted me. But I would like to see CPU and Memory (even tho SMO offers that). Also can install date (which i totally dig) be changed into [datetime] without that utc format? We can skip the disk info, however, beause of Get-DbaDiskSpace or whatever one is called.
If we can expand that disk function to include the additional info then it would be complete. I need to know what the alignment looks like, it does matter.
As well it is good to know what type of drives are showing, for just awareness of what type of SAN is in use or if physical servers what type of drives are put in. The space itself on the drives is secondary for me in this use case. Things like partition count on each drive would also be included.
@ctrlb are you for it as one command or do we break it up?
It's certainly best to create atomic tools first, like one for hardware (win32_computersystem?), OS, network,... Some of it we already have, and it may indeed be an enhancement to add one or more properties if it doesn't impact performance too much. One or more controller scripts to tie those tools together can be produced afterwards. @wsmelton do you have a list of the things you'd like to see?
Hardware:
OS:
Network:
Security:
Disks:
I created this little demo script to bundle the current dbatools functions that act on the computer level.
<#
.SYNOPSIS
Basic demo script showing use of dbatools at computer level.
.DESCRIPTION
Shows a menu to let the user choose a function to execute against a Computer.
Included are dbatools functions that act on the computer level.
Needs dbatools module installed.
User has to be local admin on the chosen target computer.
.OUTPUTS
Objects depending on the choice made.
.NOTES
Name : Get-DbaComputerInfo
Author : Klaas Vandenberghe ( @PowerDBAKlaas )
Date : 2017-02-22
#>
Clear-Host
$menu = @"
1 Get Privileges
2 Get SQL Services
3 Get Client Protocols
4 Get Disk Space
5 Get Page File Settings
6 Get SQL Memory Usage
7 Get MS DTC settings
8 Get SPN
9 Quit
"@
Write-Host $menu -ForegroundColor Yellow
[int]$choice = Read-Host "Make your Choice"
if ( $choice -eq 9 )
{
Write-Host "Have a nice day" -ForegroundColor Green
Return
}
if ( (1..9) -notcontains $choice )
{
Write-Warning "$choice is not a valid choice"
pause
&$MyInvocation.MyCommand
}
elseif ( (1..8) -contains $choice )
{
$Computername = Read-Host "Enter a computername or press Enter to use the localhost"
if ( $Computername -notmatch "\w+" ) { $computername = $env:COMPUTERNAME }
}
Switch ($choice) {
1 { Get-DbaPrivilege -computername $Computername -Verbose}
2 { Get-DbaSqlService -computername $Computername }
3 { Get-DbaclientProtocol -ComputerName $Computername }
4 { Get-DbaDiskSpace -ComputerName $Computername }
5 { Get-DbaPageFileSetting -ComputerName $Computername }
6 { Get-DbaMemoryUsage -ComputerName $Computername }
7 { Get-DbaMsDtc -ComputerName $Computername }
8 { Get-DbaSPN -ComputerName $Computername }
} #switch
pause
#re-run this script
&$MyInvocation.MyCommand
By now, the locale settings are available too.
This is just one of a thousand possible implementations, as users might want to get a daily email, or write to a DB, or ... The question is "what do we include and what do we leave up to the users?". I'm glad to provide such scripts alongside the tools, but I feel we should keep it somewhat separate.
Network and Security info, nope....there is no reason to add that because it would be considered "senstive" information in most environments, with regards to IP and such. Now NIC type. I know it used to be a big deal to check certain drivers for various model of physical NICs but now adays I'm not concerned with it.
Well, IFI and LPM might be worth adding in there...but only reason I would probably leave that out is because of the stupid interface you have to use to get that information....no native PS commands.
My thought process right now is basic information, at a high level. I'm not looking to create a thesis paper on a given server configuration. I'll see if I can find the Microsoft review document I got from a client years ago and see what info they pull on the servers. It is one I think a PFE did for a client in an onsite visit.
done deal 👍
### Is this a feature OR bug: [Feature]
Action Results
In most cases folks could have CMDB systems that contain information about their servers, or some spreadsheet that contains the information they have saved on some network share. This is just basically for that purpose to get a fresh list, or inventory servers after they were migrated possibly.
Expected Results
Just rough ideas...parameter names are just for example
Output basic info from win32_operatingsystem or other various bits that we would want to document for a given server. Could also be info we want for troubleshooting (build number, time zone mismatch to domain, etc.)
Date values would be cleaned up to display in proper format, and could also get the description of the time zone from
win32_timezone
.Parameters could be used to get additional information, or output multiple data sets:
This could output basic information and (maybe) include a data set with the disk information (e.g. disk type, partition count (or detail out volume letter and size) and also include allocation unit size). This parameter might just be for only outputting disk information, so would just say
-OnlyDiskInfo
or something like that.It may be best to break this up into a series of commands. We could create a wrapper command to output it all in multiple data sets, that could then just be piped to
ConvertTo-Html
to easily make a basic report for the server. I know this would bleed into what dbareports is for, but I would want this information without having to deploy SSRS or PowerBI.We have commands under the Test verb that check various bits of the server level information, but none that really just output for folks. Main use case I have would be try to inventory a client environment to figure out what type of OS, maybe hardware, but mostly disk storage the server is configured. This is pertinent to doing migrations to new hardware or in my case new data centers.