OneIdentity / safeguard-ps

One Identity Safeguard PowerShell scripting resources
Apache License 2.0
22 stars 27 forks source link

HP iLO / Dell iDRAC Platform Errors #491

Open imdroc opened 1 year ago

imdroc commented 1 year ago

I found couple of issues: For HP ILO: Imposible to do a "BULK" upload since always ask for platform matchings PS>New-SafeguardAsset -Platform HP iLO -AcceptSshHostKey -AssetPartition iLO -Description "iLO" -DisplayName https://server01.domain -NetworkAddress server01.domain -ServiceAccountCredentialType None Searching for platforms with 'HP' Found 3 platforms matching 'HP': [ 518 - HP iLO 519 - HP iLO MP 517 - HP-UX ] Enter platform ID or search string:

For Dell iDRAC: problem with the Service Account Credential Type not allowing None as a value. PS> New-SafeguardAsset -Platform Dell iDRAC -AcceptSshHostKey -AssetPartition iDRAC -Description "iDRAC" -DisplayName https://server02.domain -NetworkAddress server02.domain -ServiceAccountCredentialType None Searching for platforms with 'Dell' 400: Bad Request -- 60034: A service account ID or name cannot be specified with this credential type. En C:\Users\imdro\OneDrive\Documents\WindowsPowerShell\Modules\safeguard-ps\7.2.100578\sg-utilities.psm1: 181 Carácter: 5

JeffHarkavy commented 1 year ago

@imdroc When passing a multi-word platform name the value must be quoted, e.g.,

New-SafeguardAsset -Platform "HP iLO" -AcceptSshHostKey -AssetPartition iLO[...]
Searching for platforms with 'HP iLO'
Found 2 platforms matching 'HP iLO':
[
    518 - HP iLO
    519 - HP iLO MP
]
Enter platform ID or search string:

In the case of HP iLO, because the platform name matching uses a startsWith search it will still find both HP iLO and HPiLO MP. In cases like this you should use a pre-assigned platform object or the platform ID in place of the name

$hpIloPlatform = ((get-safeguardplatform) | where-object {$_.Name -eq "HP iLO"})[0]
New-SafeguardAsset -Platform $hpIloPlatform  -AcceptSshHostKey -AssetPartition iLO[...]

or

New-SafeguardAsset -Platform 518 -AcceptSshHostKey -AssetPartition iLO[...]

This also applies to the Dell iDRAC example. The system is searching for a platform named "Dell" and finding the correct platform (only one starts with that text) but is then taking the "iDRAC" portion as the next piece of data, which in this case is -ServiceAccountSecretKey. If you put quotes around the platform name it should work correctly

New-SafeguardAsset -Platform "Dell iDRAC" -AcceptSshHostKey [...]