Loading
Access or Update FNMS Cloud Data using PowerShell

Is it possible to run a PowerShell script that will update records in the FNMS cloud?  We are trying to automate as many things as possible.  Some of the things that we want to automate include setting the Active/Ignored inventory flag, and setting the Role of the inventory.  Ideally we want to read data from the FNMS cloud via an API, process it locally, and then where required call an API to update the data element in the FNMS cloud.


  • Jason,

    Currently this is not possible to access the Cloud API. You can build a business adapter on your Beacon and select the Computer node. Use the Serial number as the unique key, and set the status. I have attached a template you can populate.

    BAS.pngbas3.png

    Thanks,

    Steve

    Expand Post
  • ChrisG (Flexera Software)

    FlexNet Manager Suite Cloud and On-premises does have an internal API that other Flexera products (like App Portal) make use of. However it is not documented, supported or guaranteed to remain unchanged over future product updates. So it is not very effective for your own production use.

    With those major caveats stated, if you still want to try a scripted extraction of data from FlexNet then the GetCustomView API may be useful. The attached sample PowerShell script could be used as a starting point.

    Here is help information for the script:

    PS C:\Temp> Get-Help .\GetCustomView.ps1 -DetailedNAME C:\Temp\GetCustomView.ps1SYNOPSIS Sample script to illustrate calling the GetCustomView FlexNet Manager Suite web API to retrieve results from a report.SYNTAX C:\Temp\GetCustomView.ps1 [-ReportID] <Int32> [[-BearerToken] <String>] [[-TenantUID] <String>] [[-SearchString] <String>] [[-RowLimit] <Int32>] [[-FNMSSite] <String>] [<CommonParameters>]DESCRIPTION This script is a sample illustrating use of the GetCustomView FlexNet Manager Suite web API to retrieve results from a report that has been configured in the web UI. The "FNMP API integration" option must be enabled for your FlexNet Manager Suite license key to be able to make use of the web API. Be aware that the web API it is not documented, supported or guaranteed to remain unchanged over future product updates. This script has not been tested in a scenario where SSO using a SAML identity provider is enabled. Feedback is welcome on whether the script works in such a configuration, or what may need to be changed to get it to work. This script is provided as a sample as-is without support or warranty of any kind.PARAMETERS -ReportID <Int32> The numeric (integer) ID of the report to extract data from. This ID can be obtained from the number in the URL used to view the report in the web UI. -BearerToken <String> The bearer (or "access") token for the FlexNet Manager Suite Cloud service account to be used for authorization. A bearer token can be obtained by going to Accounts > All Accounts > Create an account > Service account in the web UI. Adda new account, and the token will be displayed once when the account is created. Be sure to remember the token, as once you navigate away from the page it is impossible to retrieve the token. If you forget the token you need to create a new service account to get another token. This parameter is not required when accessing an on premises FlexNet Manager Suite instance. -TenantUID <String> The FlexNet Manager Suite tenant UID identifying the subscription to connect to. Contact Flexera Support for your tenant UID if you do not know it. This parameter is not required when accessing a single-tenant on premises FlexNet Manager Suite instance. -SearchString <String> Text to search for in order to filter and limit the results returned. Default: Not set (no filtering will occur). -RowLimit <Int32> The maximum number of rows to return. Avoid using large values, as this API is not intended to expose massive data sets. Default: 100 -FNMSSite <String> The URL for your FNMS instance. This is typically either https://www.flexnetmanager.com (the default) or https://www.flexnetmanager.eu when using FlexNet Manager Suite Cloud. It is the URL of your FlexNet Manager Suite web application server for an on premises installation. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS C:\>$result = .\GetCustomView.ps1 -FNMSSite https://myco.flexnetmanager.com -BearerToken 01234567-89ab-cdef-0123-456789abcdef -TenantUID ABCDEFGHIJKLMNOP -ReportID 2698 -Verbose Retrieves data from the report you can view interactively at https://myco.flexnetmanager.com/Suite/Reports/View/2698 in the identified FlexNet Manager Suite Cloud tenant into the variable $result. Verbose diagnostic information is output to the PowerShell window. -------------------------- EXAMPLE 2 -------------------------- PS C:\>.\GetCustomView.ps1 -BearerToken 01234567-89ab-cdef-0123-456789abcdef -TenantUID ABCDEFGHIJKLMNOP -ReportID 99 -SearchString Acrobat -RowLimit 100 -FNMSSite https://myco.flexnetmanager.eu -Verbose | ConvertTo-Csv -NoTypeInformation | Out-File ".\GetCustomView.csv" Saves up to 100 rows of data retrieved from the report with ID 99 in the identified FlexNet Manager Suite Cloud (EU instance) tenant to the CSV file GetCustomView.csv. -------------------------- EXAMPLE 3 -------------------------- PS C:\>.\GetCustomView.ps1 -ReportID 99 -RowLimit 10000 -FNMSSite http://fnms01.internal.acme.com -Verbose | ConvertTo-Csv -NoTypeInformation | Out-File ".\GetCustomView.csv" Saves up to 10000 rows of data retrieved from the report with ID 99 from the identified on premises FlexNet Manager Suite installation to the CSV file GetCustomView.csv. Authentication to FlexNet Manager Suite is done as the currently logged in user.REMARKS To see the examples, type: "get-help C:\Temp\GetCustomView.ps1 -examples". For more information, type: "get-help C:\Temp\GetCustomView.ps1 -detailed". For technical information, type: "get-help C:\Temp\GetCustomView.ps1 -full".

    As @steven_donovan1  has suggested, using a business adapter to do updates of data in the FlexNet system is a great approach. The Business Adapter Practice Guide is a good place to start for learning about adapters.

    Expand Post
    • Chris,

       

      Appreciate the response.  Out of curiosity, is there an API that can be used to update records in the FNMS cloud?

       

      Thanks,

       

      Jason

       

      Expand Post
      • DAWN H (Flexera Software)

        The only mechanism at this time to update records in the cloud is the Business Importer provided in the FlexNet Beacon. This provides the appropriate mapping of the source to destination fields\objects. This keeps the data integrity in tact.

      • 0_Captain Kirk (Flexera Software)

        Jason, at the present time, the API mentioned by Chris is for extracting data. There currently is no API available to update data in the Cloud. Today, this is accomplished using the Business Adapter.Regards,Kirk
        • Hi @kclausen , @ChrisG  

          I'm trying to get the report data via PS, but the returned result is zero records. I've provided the report id, tenant uid, bearer-token. I'm not getting any errors, but the result is still zero records. 

          When I go to the report via WebUI, I can see the report, thought to get the results I need to "run" it (like any other custom created report). The report returns results as it should be. 

          I'm a little lost here, any advice on how to troubleshoot this issue?

          Verbose output:

           

          VERBOSE: Calling web API athttps://COMPANY.flexnetmanager.com/ManageSoftServices/ComplianceAPIService/ComplianceAPIService.asmxVERBOSE:VERBOSE: SOAP request:VERBOSE:<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"> <soap:Body> <tem:GetCustomView> <tem:customViewID>5173</tem:customViewID> <tem:rowLimit>10</tem:rowLimit> <tem:tenantUID>ABCDEFGHIJKL</tem:tenantUID> </tem:GetCustomView> </soap:Body></soap:Envelope>VERBOSE:VERBOSE: POST https://COMPANY.flexnetmanager.com/ManageSoftServices/ComplianceAPIService/ComplianceAPIService.asmx with -1-byte payloadVERBOSE: received 2133-byte response of content type application/soap+xml; charset=utf-8VERBOSE: Count of records returned: 0

          Thanks,

           

          Expand Post
          • 0_K Rasmussen (Flexera Software)

            Hi,

            Try using a a content-type of text/xml

            Regards

            Kim

            • Hi,

               

              Thanks for the suggestion. I've looked into the script file and see that the content type is already set to text/xml.

              My line 109 says:

              $result = Invoke-WebRequest -Uri $url -Headers $headers -Method Post -UseDefaultCredentials -ContentType "text/xml" -Body $soapRequestBody

              I see that the response comes as:

              VERBOSE: received 2133-byte response of content-type application/soap+xml; charset=utf-8

              Thanks,

               

              Expand Post
              • 0_K Rasmussen (Flexera Software)

                It say that it returned 2133 bytes , what is in that response ?

                There should be something that indicate what is going on ...

                Here is a Body that I know works . you need to change the report id ;-)

                <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"> <soap:Body> <tem:GetCustomView> <tem:customViewID>8605</tem:customViewID> <tem:rowLimit>100000</tem:rowLimit></tem:GetCustomView> </soap:Body></soap:Envelope>

                Regards

                Kim

                Expand Post
10 of 18

Related  Product Forums


                     â†’ Flexera One



                      â†’ Snow Atlas



                      â†’ FlexNet Manager



                      â†’ Snow License Manager



                       â†’ App Broker


       Need help finding an answer?


        Ask a Question →


Loading
Access or Update FNMS Cloud Data using PowerShell