HI @ptmorris,
I never had an “Unauthorized” message while using PowershellSDKV2. Make sure you are running Feature Release 26 or later. Here’s a sample of the output you get from SDKV2 :
# Output sample
PS C:\Users\Administrator\Documents\WindowsPowerShell> Get-MediaAgent
Description DisplayName Id Name OfflineReason Status Version
----------- ----------- -- ---- ------------- ------ -------
commserve 2 commserve ONLINE 11 SP28.19
PS C:\Users\Administrator\Documents\WindowsPowerShell> Get-ServerGroup
Association Id IsCompanySmartClientGroup IsSyncInProgress Name
----------- -- ------------------------- ---------------- ----
AUTOMATIC 1 False Infrastructure
AUTOMATIC 2 False Proxy Clients
AUTOMATIC 3 False Media Agents
AUTOMATIC 4 False Laptop Clients
Overall, I prefer SDK1 because the output handling is much better, but it has a very limited number of cmdlets. SDK2 is more of a work in progress. It is not really sysadmin friendly. If you have some development skills in PowerShell, you can easily customize the functions.
If you wish to do your own API calls, here’s how you can get a token on your own in PowerShell :
# How to connect and get a token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"password`": `"Password_in_Base64`",`n `"username`": `"admin`",`n `"timeout`" : 30`n}"
$response = Invoke-RestMethod 'http://WebServerName/webconsole/api/Login' -Method 'POST' -Headers $headers -Body $body
$token = $response.token
Once you have the token, you can issue commands from https://api.commvault.com/#3707251b-cc26-8c00-fb24-d007e6d8d236. Make sure you select Language: PowerShell-REST Method.
Hope this helps you in your Commvault PowerShell journey!