Highlighted
Occasional contributor

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.

Tags (1)
0 Kudos
18 Replies
Highlighted
Intrepid explorer

Re: Access or Update FNMS Cloud Data using PowerShell

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.pngBas2.pngbas3.pngbas4.png

Thanks,

Steve

Highlighted
Community Manager Community Manager
Community Manager

Re: Access or Update FNMS Cloud Data using PowerShell

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:

Spoiler
PS C:\Temp> Get-Help .\GetCustomView.ps1 -Detailed

NAME
    C:\Temp\GetCustomView.ps1

SYNOPSIS
    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.

(Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".)
Highlighted
Occasional contributor

Re: Access or Update FNMS Cloud Data using PowerShell

Steven,

 

Thanks for the feedback.

 

Jason

 

0 Kudos
Highlighted
Occasional contributor

Re: Access or Update FNMS Cloud Data using PowerShell

Chris,

 

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

 

Thanks,

 

Jason

 

0 Kudos