09-21-2018 07:57 AM
Hi
This script package has been created as an example of how to consume the NetBackup Self Service (NSS) REST API to register a list of computers in the NSS computer inventory. While we use a CSV file as the computer list import source in this example, other alternative sources could use the same approach, a CSV file here being one of the simplest possible examples.
Jon
03-19-2019 10:08 AM
Thank you @JonHunt is an amazing tool to populate machine list.
05-03-2020 05:01 AM
I tried this with NSS 8.2 but it failed, can you help, please
PS C:\Program Files\Biomni\NetBackup Self Service Adapter 8.2\SDK\v6\Admin Samples> & '.\NetBackup Self Service CSV Import Example.ps1'
Invoke-NssLoginAsUser : A parameter cannot be found that matches parameter name 'PanelsUrl'.
At C:\Program Files\Biomni\NetBackup Self Service Adapter 8.2\SDK\v6\Admin Samples\NetBackup Self Service CSV Import Example.ps1:14 char:39
+ $access_token = Invoke-NssLoginAsUser -PanelsUrl $panelsUrl -UserName $username ...
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-NssLoginAsUser], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Invoke-NssLoginAsUser
New-NssAuthorizationHeader : The term 'New-NssAuthorizationHeader' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\Program Files\Biomni\NetBackup Self Service Adapter 8.2\SDK\v6\Admin Samples\NetBackup Self Service CSV Import Example.ps1:15 char:12
+ $headers = New-NssAuthorizationHeader -AccessToken $access_token
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-NssAuthorizationHeader:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\Biomni\NetBackup Self Service Adapter 8.2\SDK\v6\Admin Samples\NetBackup Self Service CSV Import Example.ps1:30 char:30
+ $protectionTypesResult = Invoke-RestMethod -Headers $headers -Uri "$apiUrl/p ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
The Protection type ID found for Protection Type code 40 was
Invoke-RestMethod : {"Message":"Authorization has been denied for this request."}
At C:\Program Files\Biomni\NetBackup Self Service Adapter 8.2\SDK\v6\Admin Samples\NetBackup Self Service CSV Import Example.ps1:62 char:22
+ $machineResult = Invoke-RestMethod -Headers $headers -Method Post -Uri "$api ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
New machine created with Id ''
05-03-2020 07:45 AM
i edited the script and it's working now
10-27-2020 08:22 AM - edited 10-27-2020 10:10 AM
The updated package for NSS versions 8.2. and 8.3. is attached below: