Comments (9)
If your run it without the where-object does it return anything?
from snipeitps.
I've tried without the where-object and I get this error message:
At line:1 char:1135
- ... WM2Il0qU6hCHDn3Gpt7szK7ziQfgYv-WI_rVXLSX2gIFk" | {$_.name -eq "MIS" }
-
~~~~~~~~~~~~~~~~~~~~
Expressions are only allowed as the first element of a pipeline.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
I ran the whole command with verbose and this is what i get:
VERBOSE: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
VERBOSE: [Invoke-SnipeitMethod] Invoking method Get to URI
https://snipe.maderacoe.org/api/v1/hardware?offset=0&sort=created_at&limit=50&order=desc
VERBOSE: GET https://snipe.maderacoe.org/api/v1/hardware?offset=0&sort=created_at&limit=50&order=desc with 0-byte
payload
VERBOSE: [Invoke-SnipeitMethod] Failed to get an answer from the server
VERBOSE: [Invoke-SnipeitMethod] No Web result object was returned from. This is unusual!
VERBOSE: [Invoke-SnipeitMethod] Function ended
from snipeitps.
The log suggests it cannot connect to the server
from snipeitps.
That's strange, i've tried the IP address and hostname and I get the same error message. I've also turned off the firewall on Snipe-IT server. I'm missing something. Any suggestions?
from snipeitps.
@dilpatel45 are you still having issues with this? if so can you try running
Get-Asset -url "https://name.org" -apikey "keystringinhere" -verbose
from snipeitps.
@snazy2000 yes, i'm still having issues. Is there something in snipe I need to change or alter or verify?
PS C:\Windows\system32> Get-Asset -url "https://snipe.domain.org" -apikey "KEY(actual key)" -verbose
VERBOSE: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
VERBOSE: [Invoke-SnipeitMethod] Invoking method Get to URI
https://snipe.maderacoe.org/api/v1/hardware?offset=0&sort=created_at&limit=50&order=desc
VERBOSE: GET https://snipe.maderacoe.org/api/v1/hardware?offset=0&sort=created_at&limit=50&order=desc with 0-byte
payload
VERBOSE: [Invoke-SnipeitMethod] Failed to get an answer from the server
VERBOSE: [Invoke-SnipeitMethod] No Web result object was returned from. This is unusual!
VERBOSE: [Invoke-SnipeitMethod] Function ended
PS C:\Windows\system32>
from snipeitps.
Can you access the url from the machine your running the script? Do you have anything on your network that blocks powershell making requests like your AV or firewall.
Is the key 100% correct? May be worth trying to access it via application like postman to make sure you can access the API etc
from snipeitps.
Yes, I've verified i can resolve the hostname. I've even tried turning off the firewall internally for testing. Same issue. Yes, i've generated the key multiple times but same error message. I'll check with postman and update again.
from snipeitps.
Got it working now, thanks. I was using a Self-Signed certificate to access snipe. I found this command online to bypass and allow self-signed certificates:
if (-not("dummy" -as [type])) {
add-type -TypeDefinition @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public static class Dummy {
public static bool ReturnTrue(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors) { return true; }
public static RemoteCertificateValidationCallback GetDelegate() {
return new RemoteCertificateValidationCallback(Dummy.ReturnTrue);
}
}
"@
}
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [dummy]::GetDelegate()
Source: https://stackoverflow.com/questions/36456104/invoke-restmethod-ignore-self-signed-certs
from snipeitps.
Related Issues (20)
- Issues with Set-SnipeITAsset HOT 2
- Set-SnipeitConsumable HOT 2
- Password required when making new user HOT 3
- Script stops before for loop is completed. Limit exceeded? HOT 3
- Using v1.10.222 with Snipe-IT v6.0.1 HOT 1
- Unable to access server once moved to https HOT 3
- Will not connect to on-prem non-SSL setup? HOT 1
- API Request throttling HOT 1
- Unable to Connect to SnipeItPS HOT 1
- Connect-SnipeitPS is erroring out HOT 1
- New-SnipeITuser returns 422 HOT 4
- Licence Checkout without specifying the seat id. HOT 3
- Update Status ID on Set-SnipeITAssetOwner HOT 1
- Create Functionality to Create and Modify Fieldsets
- Return MAC Address (custom fieldset) with "Get-SnipeITAsset -status 'Deployed'" HOT 1
- New-SnipeitUser -deleted param
- New-SnipeitLicense fails when license_email parameter provided
- Issue with Set-SnipeITAsset
- Issue with New-SnipeitAsset
- Forbidden: New-SnipeItAsset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snipeitps.