<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Snapcenter vshpere plugin 4.5 - powershell in VMware Solutions Discussions</title>
    <link>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/169826#M9841</link>
    <description>&lt;P&gt;What kind of queries are you attempting to run?&lt;/P&gt;</description>
    <pubDate>Thu, 09 Sep 2021 05:52:37 GMT</pubDate>
    <dc:creator>aladd</dc:creator>
    <dc:date>2021-09-09T05:52:37Z</dc:date>
    <item>
      <title>Snapcenter vshpere plugin 4.5 - powershell</title>
      <link>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/169746#M9840</link>
      <description>&lt;P&gt;Dear team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to generate a token for api queries with powershell, but can't find the right way to do it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I generate a token with powrrshell or create a permanent token?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 10:14:36 GMT</pubDate>
      <guid>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/169746#M9840</guid>
      <dc:creator>Nirsh</dc:creator>
      <dc:date>2025-06-04T10:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Snapcenter vshpere plugin 4.5 - powershell</title>
      <link>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/169826#M9841</link>
      <description>&lt;P&gt;What kind of queries are you attempting to run?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 05:52:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/169826#M9841</guid>
      <dc:creator>aladd</dc:creator>
      <dc:date>2021-09-09T05:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Snapcenter vshpere plugin 4.5 - powershell</title>
      <link>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/171318#M9856</link>
      <description>&lt;P&gt;This is how I did it, not necessarily the best or tidiest way.&amp;nbsp; I was trying to learn how to do REST APIs in PowerShell, so it's probably a mixture of multiple methods.&amp;nbsp; I never did go back and finish the script I was writing (for backup reports).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$RESTAPIServer = "&amp;lt;snapcenter appliance fqdn/ip&amp;gt;:8144"

# Get credentials
try {
    $credentials = Import-Clixml &amp;lt;file with encrypted credentials&amp;gt;.xml -ErrorAction:Stop
} catch {
    write-host "Could not open credentials." -ForegroundColor Red
    exit (1)
}
$REST_API_User = $credentials.UserName
$REST_API_Password = $credentials.GetNetworkCredential().Password

$loginRequest = @{
    username = $REST_API_User
    password = $REST_API_Password
} | ConvertTo-Json

# Set REST authentication headers
$baseURL = "https://" + $RESTAPIServer + "/api/4.1"
$SnapcenterSessionURL = $baseURL + "/auth/login"
$Type = "application/json"

$params = @{
    Uri = $SnapcenterSessionURL
    Body = $loginRequest
    ContentType = 'application/json'
    Method = 'POST'
}

$authResponse = Invoke-RestMethod @params
if ($authResponse.statusCode -eq 200) {
    write-host "Authentication successful"
    $authToken = $authResponse.response.token
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The credentials are encrypted in an XML file, only decryptable by the account &amp;amp; on the machine that they were encrypted on.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 15:50:13 GMT</pubDate>
      <guid>https://community.netapp.com/t5/VMware-Solutions-Discussions/Snapcenter-vshpere-plugin-4-5-powershell/m-p/171318#M9856</guid>
      <dc:creator>TonyPatton</dc:creator>
      <dc:date>2021-11-01T15:50:13Z</dc:date>
    </item>
  </channel>
</rss>

