Easily work with BigFix APIs in PowerShell

New-WebReportsSession : Cannot validate argument on parameter ‘Uri’. The term ‘Test-Uri’ 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 i
s correct and try again.

getting this error=\

@MDMike

Need to post your example, it sounds like you are trying to use a variable named ‘Test-Uri’ but are doing it incorrectly.

Relevance Status Execution Time Evaluation Time Result Count Result


number of computers Error 00:00:00.0621765 1 Exception calling “GetStructuredRelevanceResult” with “1” argument(s): “Invalid username or password.”

@JasonWalker

but it is my pass and user=/

Still haven’t posted your example…

$session = New-WebReportsSession -uri 'https://myservername/webreports/'
Invoke-EvaluateSessionRelevance -Relevance ‘number of computers’ -Session $session

@JasonWalker

It appears you are not trying to authenticate here.

but it prompt me to insert creds
@JasonWalker

I’m not that familiar with this PowerShell module (I generally use Python, myself) but this article on the different escape codes available in Powershell input may be helpful

https://ss64.com/ps/syntax-esc.html

Please do post back when you find a combination that works for escaping the ampersand in your password, this will likely be helpful for others.

@iftachzi can you do the following and post back your output?

Import-Module 'BigFix' -Verbose -Force
$session = New-WebReportsSession -Uri 'https://myservername/' -Verbose
Invoke-EvaluateSessionRelevance -Relevance 'number of computers' -Session $session -Verbose

Test-Uri is an internal function to validate the arguments so based upon what you posted, the import may not have fully loaded everything.

It’s possible that an & in the password might cause a fault however this module leverages the WSDL proxy generation routines built-in to .NET so they should be smart enough to handle proper encoding. My dev environment is down at the moment but I’ll try and test for this as soon as I can to verify it does proper encoding. If you send me a private message with any special (or non-US ASCII) characters you might be using in either the username or password fields, I can ensure to test using them as well.

ill try this!!:slight_smile:

MDMike - After executing New-WebReportSession -Uri “https://[url]” -Verbose, a popup prompts me to enter username and password. After entering these, the popup goes away, and the following is printed to the shell:

VERBOSE: obtaining Web Reports API Service descriptor 'https://[url]/?wsdl’
VERBOSE: Unable to obtain and/or instantiate the Web Reports API service descriptor ‘https://[url]/?wsdl’!

I’m new to Bigfix and am trying to automate download of report data and pushing it into an ECM. is there some way of extracting more detailed error data to help me troubleshoot? and how do i go about verifying what the appropriate URL should be for pulling inventory reports - is it the same URL that I use to access reports via the web interface?

The New-WebReportsSession function will attempt to grab the WSDL from the web reports server to create the connection object. The WSDL is a computer-readable definition of the API. Due to the way BigFix wrote the WSDL, there is a small chance that the process .NET uses to convert this into a binary object that Powershell can then use will fail. What you are seeing in this error message is this. I wrote it this way so that if BigFix ever changed the API, the module would not have to be updated however it appears it is more trouble than it is worth.

If you were to totally close out of the Powershell session and re-open one, it should allow you to try again. The URL’s are the same as if you were to leverage the WebReports SOAP API. This module just helps in wrapping and unwrapping the requests/results into something more Powershell friendly.

MDMike - what I am experiencing is repeatable. Its the same experience whether I launch a new elevated SharePoint Management Shell or reexecute in the existing one. BTW: I’m testing accessing BigFix webreports from a SharePoint server. Installed BigFix PowerShell module is BigFix version 1.0 downloaded from PSGallery; and it installed without any issue.

  • Any troubleshooting guidance you could offer? Tweaks to probe the problem with?

I am seeing some of the same results as the earlier user.
Can anyone help point out what mistake I am making, or if there is a better way to accomplish this?
Here is my code and results:
Import-Module ‘BigFix’ -Verbose -Force
$session = New-WebReportsSession -Uri ‘https://bigfix.corp.xxx.com/’ -Verbose
Invoke-EvaluateSessionRelevance -Relevance ‘number of computers’ -Session $session -Verbose

nvoke-EvaluateSessionRelevance -Relevance ‘number of computers’ -Session $session -Verbose
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\BigFix\1.0\BigFix.psd1’.
VERBOSE: Removing the imported “Set-WebReportsServer” function.
VERBOSE: Removing the imported “New-WebReportsSession” function.
VERBOSE: Removing the imported “New-WebReportsServer” function.
VERBOSE: Removing the imported “Invoke-EvaluateSessionRelevance” function.
VERBOSE: Removing the imported “Get-WebReportsSession” function.
VERBOSE: Removing the imported “Get-WebReportsServer” function.
VERBOSE: Loading ‘FormatsToProcess’ from path ‘C:\Program Files\WindowsPowerShell\Modules\BigFix\1.0\BigFix.Format.ps1xml’.
VERBOSE: Populating RepositorySourceLocation property for module BigFix.
VERBOSE: Loading module from path ‘C:\Program Files\WindowsPowerShell\Modules\BigFix\1.0\BigFix.psm1’.
VERBOSE: Exporting function ‘Get-WebReportsServer’.
VERBOSE: Exporting function ‘Get-WebReportsSession’.
VERBOSE: Exporting function ‘Invoke-EvaluateSessionRelevance’.
VERBOSE: Exporting function ‘New-WebReportsServer’.
VERBOSE: Exporting function ‘New-WebReportsSession’.
VERBOSE: Exporting function ‘Set-WebReportsServer’.
VERBOSE: Exporting function ‘ParseStructuredResult’.
VERBOSE: Exporting function ‘ParseInnerStructuredResult’.
VERBOSE: Exporting function ‘Test-Uri’.
VERBOSE: Importing function ‘Get-WebReportsServer’.
VERBOSE: Importing function ‘Get-WebReportsSession’.
VERBOSE: Importing function ‘Invoke-EvaluateSessionRelevance’.
VERBOSE: Importing function ‘New-WebReportsServer’.
VERBOSE: Importing function ‘New-WebReportsSession’.
VERBOSE: Importing function ‘Set-WebReportsServer’.
VERBOSE: Test-Uri will be validating using UriKind 'Absolute’
VERBOSE: Test-Uri will be validating using UriKind 'Absolute’
VERBOSE: Test-Uri will be validating using UriKind 'Absolute’
VERBOSE: Prompting for account credentials.
VERBOSE: Obtaining Web Reports API service descriptor ‘https://bigfix.corp.xxx.com/?wsdl’.
VERBOSE: Connecting to Web Reports Server: https://bigfix.corp.xxx.com/
VERBOSE: Evaluating Relevance: maximum of versions of modules
VERBOSE: Evaluation produced 1 answer(s) in 00:00:02.3608002.
VERBOSE: Connected to Web Reports Server: https://bigfix.corp.xxx.com/ (Version 10.0.4.32)
VERBOSE: Evaluating Relevance: number of computers
VERBOSE: Evaluation failed: Exception calling “GetStructuredRelevanceResult” with “1” argument(s): “Invalid username or password.”

Relevance Status Execution Time Evaluation Time Result Count Result


number of computers Error 00:00:00.0947288 1 Exception calling “GetStructuredRelevanceResult” with “1” argument(s): “Invalid username or password.”

I want to Query bigfix and retrieve computer names and a few other for use in a powershell script.
I have tried https://servername, Https://servername/, Https://servername/webreports and Https://servername/webreports/
If this would be easier using soap or rest please let me know how I could go about doing that, preferably in PowerShell.
I appreciate any suggestions anyone can offer
Thank You

Not entirely sure why it’s throwing the Invalid username or password exception… I’ll have to look into that.

I think the issue is your query. “number of computers” is not valid session relevance. You should be using “number of bes computers” here.

There has been a lot of progress behind the scenes on the Powershell module over the past year and once I complete validation, I will publish a new release to the PSGallery and GitHub.

I get about the same result in that query:
invoke-EvaluateSessionRelevance -Relevance ‘number of BES computers’ -Session $session -Verbose
VERBOSE: Evaluating Relevance: number of BES computers
VERBOSE: Evaluation failed: Exception calling “GetStructuredRelevanceResult” with “1” argument(s): “Invalid username or password.”

Relevance Status Execution Time Evaluation Time Result Count Result


number of BES computers Error 00:00:00.1068640 1 Exception calling “GetStructuredRelevanceResult” with “1” argument(s): "Invalid usern…

I tried doing something like this using IEMCLI but I cannot seem to get powershell to convert the XML into an array or any other format

Any assistance would be appreciated

Thanks

I have just published version 1.1 of the BigFix module to the PowerShell Gallery. As part of this update, several portions of the code base were changed to better handle edge case issues folks have reported and while I still do not know exactly why you are getting this specific issue, the update may resolve any complications you might have.

Update-Module -Name BigFix