FOG API help
-
Hello all,
I haven’t posted in a while, so I need a little help.
I’m running Server 2019 Data Center on my test desktop machine and have FOG API installed. The script runs great by itself, ex; adding the machine name and snapins based on parameters, but here’s the issue.I’m testing out a third party software called Au2mator. It can use an engine like Powershell. I have the questions in parameters and when it runs, it creates the task and machine name in Powershell, but doesn’t add the machine to the group or does it add the snapins. I have the Au2mator software using a service account that has local AD rights on the box, the pool has the correct service account and password, but still get these errors when I run it with the Au2mator software:
Log Name: PowerShellCore/Operational
Source: PowerShellCore
Date: 2/3/2022 6:16:31 AM
Event ID: 4100
Task Category: Executing Pipeline
Level: Warning
Keywords: None
User: JBCORP\Au2umator
Computer: HYPER-SRV.jbcorp.com
Description:
Error Message = Cannot bind parameter ‘Uri’. Cannot convert value “http://your fog server hostname or ip address to be used for created the url used in api calls default is fog-server or fogServer/fog/task/active” to type “System.Uri”. Error: “Invalid URI: The hostname could not be parsed.”
Fully Qualified Error ID = CannotConvertArgumentNoMessage,Invoke-FogApiContext:
Severity = Warning
Host Name = Default Host
Host Version = 7.1.3
Host ID = ad4c57c0-2fac-4d68-a7c0-d9af957dc1a0
Host Application = C:\Inetpub\au2mator\A2M.Presentation.dll
Engine Version = 7.1.3
Runspace ID = 4e8439ad-a4ba-4dc0-adeb-519501e60f21
Pipeline ID = 1
Command Name = Invoke-FogApi
Command Type = Function
Script Name = C:\Program Files\WindowsPowerShell\Modules\FogApi\2103.2.12\FogApi.psm1
Command Path =
Sequence Number = 31
User = testdomain\testaccount
Connected User =
Shell ID = Microsoft.PowerShellUser Data:
Event Xml:
<Event xmlns=“http://schemas.microsoft.com/win/2004/08/events/event”>
<System>
<Provider Name=“PowerShellCore” Guid=“{f90714a8-5509-434a-bf6d-b1624c8a19a2}” />
<EventID>4100</EventID>
<Version>1</Version>
<Level>3</Level>
<Task>106</Task>
<Opcode>19</Opcode>
<Keywords>0x0</Keywords>
<TimeCreated SystemTime=“2022-02-03T11:16:31.401253300Z” />
<EventRecordID>1654</EventRecordID>
<Correlation ActivityID=“{b5238339-183a-0002-0598-30b53a18d801}” />
<Execution ProcessID=“12736” ThreadID=“14664” />
<Channel>PowerShellCore/Operational</Channel>
<Computer>HYPER-SRV.jbcorp.com</Computer>
<Security UserID=“S-1-5-21-3280824798-2153847428-653206688-5347” />
</System>
<EventData>
<Data Name=“ContextInfo”> Severity = Warning
Host Name = Default Host
Host Version = 7.1.3
Host ID = ad4c57c0-2fac-4d68-a7c0-d9af957dc1a0
Host Application = C:\Inetpub\au2mator\A2M.Presentation.dll
Engine Version = 7.1.3
Runspace ID = 4e8439ad-a4ba-4dc0-adeb-519501e60f21
Pipeline ID = 1
Command Name = Invoke-FogApi
Command Type = Function
Script Name = C:\Program Files\WindowsPowerShell\Modules\FogApi\2103.2.12\FogApi.psm1
Command Path =
Sequence Number = 31
User = JBCORP\au2umator
Connected User =
Shell ID = Microsoft.PowerShell
</Data>
<Data Name=“UserData”>
</Data>
<Data Name=“Payload”>Error Message = Cannot bind parameter ‘Uri’. Cannot convert value “http://your fog server hostname or ip address to be used for created the url used in api calls default is fog-server or fogServer/fog/task/active” to type “System.Uri”. Error: “Invalid URI: The hostname could not be parsed.”
Fully Qualified Error ID = CannotConvertArgumentNoMessage,Invoke-FogApi
</Data>
</EventData>
</Event>I’ve tried a few things like putting the url directly instead of using $baseuri, even tried “$baseuri/restofurl” same issue. I’m not sure what I’m missing here.
I know I’ve worked with a few guys on here with the FOG API via Powershell, so if I can get assistance, I appreciate it.
-
@jamaal said in FOG API help:
Cannot convert value “http://your fog server hostname or ip address to be used for created the url used in api calls default is fog-server or fogServer/fog/task/active”
I have not used @JJ-Fullmer’s FogApi yet I have to admit. But this message seems to stem from the settings.json not being setup correctly: https://github.com/darksidemilk/FogApi/blob/master/FogApi/lib/settings.json
-
@sebastian-roth said in FOG API help:
@jamaal said in FOG API help:
Cannot convert value “http://your fog server hostname or ip address to be used for created the url used in api calls default is fog-server or fogServer/fog/task/active”
I have not used @JJ-Fullmer’s FogApi yet I have to admit. But this message seems to stem from the settings.json not being setup correctly: https://github.com/darksidemilk/FogApi/blob/master/FogApi/lib/settings.json
I’ll definitely check this out today, thanks Sebastian. One more question. How would I add location via api? We have our main site and also have another location and I wanted the techs to select Boston as a site for example. I do have the plug in enabled via the console, but want to do it in the Powershell script if possible.
-
@jamaal said in FOG API help:
One more question. How would I add location via api?
Not something I can properly answer. Though looking at the repo I think the @JJ-Fullmer’s powershell module does not handle locations: https://github.com/darksidemilk/FogApi/tree/master/FogApi/Public