cancel
Showing results for 
Search instead for 
Did you mean: 

NetBackup Self Service CSV Machine / Computer Import Example

JonHunt
Moderator
Moderator
   VIP   

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

4 REPLIES 4

sv_jioo86
Level 3

Thank you @JonHunt is an amazing tool to populate machine list.

Hhay83
Level 3

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 ''

 

 

i edited the script and it's working now 

Ben_Rigby
Level 4

The updated package for NSS versions 8.2. and 8.3. is attached below: