Forum Discussion
cgaines22_14499
Nimbostratus
Mar 22, 2016PowerShell Help with JSON and Invoke-WebRequest
This is the F5
$MyLTM_IP = '10.5.183.4'
Load the SnapIn first
Add-PSSnapIn iControlSnapIn
Need to create Login
$secpasswd = ConvertTo-SecureString 'password1' -AsPlainText -Force$m...
cgaines22_14499
Nimbostratus
Mar 23, 2016This Works [example](Invoke-WebRequest -Method GET -URI 'https://10.5.183.4/mgmt/tm/ltm/pool/?$filter=partition eq Certlab' -Credential $mycreds)
- Brad_ParkerMar 23, 2016
Cirrus
For what its worth I would recommend using Invoke-RestMethod rather than Invoke-WebRequest. As for your question about getting a 401. You will need to authenticate with a get request before you send a PUT or POST. I'm not sure why this is the case, but it works. - cgaines22_14499Mar 23, 2016
Nimbostratus
Thanks Brad that changed the look of the Get request to a short return versus using Invoke-WebRequest. They both return values but Invoke-RestMethod seems to only refer to the object in the URI not the whole URI list. I will try the Get statement before the Post statement and see what occurs.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
