Add local Windows Server inventory collection and validation; include core package
This commit is contained in:
23
powershell/Get-ServerStorage.ps1
Normal file
23
powershell/Get-ServerStorage.ps1
Normal file
@@ -0,0 +1,23 @@
|
||||
function Get-SamsaraStorage {
|
||||
param($Result)
|
||||
Invoke-SamsaraRead $Result 'Local volumes' {
|
||||
$Result.data = @(Get-Volume -ErrorAction Stop | ForEach-Object {
|
||||
[pscustomobject]@{ type = 'Volume'; name = [string]$_.FileSystemLabel
|
||||
path = if ($_.DriveLetter) { [string]$_.DriveLetter + ':\' } else { [string]$_.Path }
|
||||
filesystem = [string]$_.FileSystem; capacity_gib = [math]::Round(([double]$_.Size / 1GB), 2)
|
||||
free_gib = [math]::Round(([double]$_.SizeRemaining / 1GB), 2) }
|
||||
})
|
||||
}
|
||||
$Result.limitations += 'Local volume metadata only. Share contents, mounted remote storage, storage-array dependencies, snapshots and backups are not inspected.'
|
||||
}
|
||||
|
||||
function Get-SamsaraShares {
|
||||
param($Result)
|
||||
Invoke-SamsaraRead $Result 'SMB shares' {
|
||||
$Result.data = @(Get-SmbShare -ErrorAction Stop | ForEach-Object {
|
||||
[pscustomobject]@{ type = 'SMB Share'; name = [string]$_.Name; path = [string]$_.Path
|
||||
capacity_gib = $null; free_gib = $null; special = [bool]$_.Special }
|
||||
})
|
||||
}
|
||||
$Result.limitations += 'Configured SMB shares, including administrative shares. No share contents, ACLs, credentials, sessions or consumers queried. Existence does not establish use.'
|
||||
}
|
||||
Reference in New Issue
Block a user