Ok, let me try some things this week and let you guys know. Thanks guys.
Posts made by Jamaal
-
RE: Dell Latitude 5530 issue
-
Dell Latitude 5530 issue
Hello, all,
I haven’t posted in a while because I haven’t had any issues for a long time. So there it goes.
We recently started purchasing Dell Latitude 5530 laptops I have an issue with them for some reason.
First off, the version of FOG I have is 1.5.9 now, had 1.5.10 and went back down because I thought this was causing the issue.The problem is that FOG images the laptop fine, but when it restarts to boot into Windows and continue the step “getting devices ready”, it goes right
to the ctrl alt delete screen and then the administrator password is not working. This is very weird.Before I downgraded back to 1.5.9, I reimaged a Lenovo T510 laptop (yes it’s a dinosaur, lol) to rule out anything with setupcomplete.cmd, imaged with no issues.
I have FOG running on Ubuntu 20.04.6 on Windows Hyper-v, 2019.
I deleted the network drivers from the Latitude 5530 folder numerous times and still after it images, the network at the ctrl alt delete is not working.
No wireless nor network card, can’t even log onto the laptop.I know I have the pnp command in the setupcomplete.cmd and it works fine on Lenovo laptops, but for some reason from since yesterday, I started to run into issues.
I looked in the forum before posting this, but can’t find any solution. If someone can give me an idea why this is happening, I appreciate it. -
RE: HyperV Gen1 Hangs on iPXE Initializing Devices
@Gerrit-Anderson Thank you for this! I was battling this yesterday and this fixed the issue immediately.
-
RE: Powershell and fog
@sebastian-roth said in Powershell and fog:
@Jamaal Anything in the Apache error logs? Sure the API is enabled (user and global)?
Yes, the API is enabled. I’m not sure on how to check the apache error logs.
-
RE: Powershell and fog
@tom-elliott said in Powershell and fog:
@jamaal What if you define fogsrv to the IP address of the fogserver?
FQDN must be reachable by the device in question. Using the IP address is usually a more sure bet.
I’m going to try that later & let you know. Thanks for the suggestion, Tom.
-
RE: Powershell and fog
@tom-elliott said in Powershell and fog:
@jamaal is fogsrv the actual fqdn of your fogserver?
Yes, just for testing purposes. Eventually I will have a different name.
-
Powershell and fog
Hello jj,
I hope all is well with you. I am having fun with Powershell and the machine deployment. I
have one question. So I’m having a little hard time with one thing. I would like to have Powershell create an image name in the images section in FOG. Now I can go in the console manually and create an image name for example Windows 10 22h2, but how would I go about creating it automatically in Powershell if it doesn’t exit?I tried new-fogobject -type object -coreobject image -jsondata $hostimage -verbose and got the 417 error. I had the json like this:
VERBOSE: Building uri and api call
VERBOSE: Pulling settings from settings file
VERBOSE: Pulling settings from settings file
VERBOSE: Building Headers…
VERBOSE: Building api call URI…
VERBOSE: POSTing System.Collections.Hashtable to/from http://fogsrv/fog/image/create
VERBOSE: POST http://fogsrv/fog/image/create with -1-byte payload
VERBOSE: POST http://fogsrv/fog/image/create with -1-byte payload
Invoke-WebRequest : The remote server returned an error: (417) Expectation Failed.
At C:\Program Files\WindowsPowerShell\Modules\FogApi\2103.2.12\FogApi.psm1:780 char:23-
$result = Invoke-WebRequest @apiCall;
-
~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebR
equest], WebException - FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequ
estCommand
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebR
VERBOSE: finished api call
I can’t do new-item because Powershell says it can’t find the path to the URL which I understand in that case you can’t use new-item, not like you’re creating a folder or file in the Windows operating system. I’ll keep trying, but that would be a good feature instead of creating it in the console. I’m trying to make the script more dynamic if something doesn’t exist in the console.
Again, thanks to you and the other person (forgot his screen name) that helped with Powershell and FOG, makes a huge difference!
-
-
RE: Need help to understand host.class.php
@jamaal said in Need help to understand host.class.php:
Hello all,
I’m banging my head to understand the host.class.php file.
I have a few posts based on Powershell to add the “location” field for a computer to be created for example.I already have the locations plug in installed and it works fine in the gui, but when I run the powershell script, location doesn’t show in Powershell, but in the gui.
I’m not trying to image yet, but I want to be able to add on a custom website; ex; Jira ticket system, the host location. It should match up in the “location” field in Powershelll.
I saw a post you can edit the host.class.php file.
I did and here’s a screen shot:
I went to create a host and it doesn’t show up, not sure what I’m doing wrong.
Here’s when I went to see if the host got created when attempting to add it via the gui. I forgot to get the words before it, but it says hosts not found.
If I can get some guidance to what I’m donig wrong, I appreciate it.
Here’s my version of FOG:
All,
This can be resolved. I finally was able to add location via Powershell! I didn’t even need to mess with the host.class file in FOG. This is thanks too @JJ-Fullmer . He had a reference to a post he had about Powershell and FOG via adding groups:
https://forums.fogproject.org/topic/12026/powershell-api-module/15?_=1648864559519
So I ended up adding another variable called $newassocias2
Again thanks to everyone that contributes to this page. I’m happy & grateful to using this product.
-
Need help to understand host.class.php
Hello all,
I’m banging my head to understand the host.class.php file.
I have a few posts based on Powershell to add the “location” field for a computer to be created for example.I already have the locations plug in installed and it works fine in the gui, but when I run the powershell script, location doesn’t show in Powershell, but in the gui.
I’m not trying to image yet, but I want to be able to add on a custom website; ex; Jira ticket system, the host location. It should match up in the “location” field in Powershelll.
I saw a post you can edit the host.class.php file.
I did and here’s a screen shot:
I went to create a host and it doesn’t show up, not sure what I’m doing wrong.
Here’s when I went to see if the host got created when attempting to add it via the gui. I forgot to get the words before it, but it says hosts not found.
If I can get some guidance to what I’m donig wrong, I appreciate it.
Here’s my version of FOG:
-
RE: Fog Location help via FOG API
@jamaal said in Fog Location help via FOG API:
@jamaal said in Fog Location help via FOG API:
Hello, all
I’m starting to get closer, but not sure what I’m missing. I read up on pscustomobject and I did the following in the script. So in the first screen shot, I got the member properties from get-foghost -hostname $machinename | get-member
The screenshot called “before”, doesn’t have the location field.
What I did was created a pscustomobject by creating a variable called $member
so $member = new-object -typename psobject
The screenshot I did later was called “after”
I then did $member | get-member and it added location as you can see in the screen shot.
In the parameter, I did location = Westbury for example. Here’s some screen shots of my script.code that I used to add location:
So I already have the plugin Location installed with values such as Woodbury and Edison.
I’m trying to get Powershell to just load my section from $location to location as seen below, but it’s not working despite I used the pscustomobject
I also tried adding location under $hostjson to see if this helps before as well.
Ok,
This is resolved now. Here are the steps I did to fix this in case someone else needs this in their Powershell script.
You need to go the Powershell module file in C:\Program Files\WindowsPowerShell\Modules\FogApi\2103.2.12
Once in there, open up the FogApi.psm1 file and look for the line that says $coreObjects = @(
add this to the line in alphabetical order:
“location” and save the file.
Once you did that, go to powershell and type in:
Get-FogObject -type object -coreObject location
If done right, you’ll see the location correspond to the location plug in you installed.
and after:
You don’t need to mess with the pscustomobject because when you install the plugin and edit the psm1 file, it will do it automatically for you.
This can be closed. I’ll create a tutorial on the exact steps because you need to create storage nodes if you have multiple sites in mind.
-
RE: Fog Location help via FOG API
@jamaal said in Fog Location help via FOG API:
Hello, all
I’m starting to get closer, but not sure what I’m missing. I read up on pscustomobject and I did the following in the script. So in the first screen shot, I got the member properties from get-foghost -hostname $machinename | get-member
The screenshot called “before”, doesn’t have the location field.
What I did was created a pscustomobject by creating a variable called $member
so $member = new-object -typename psobject
The screenshot I did later was called “after”
I then did $member | get-member and it added location as you can see in the screen shot.
In the parameter, I did location = Westbury for example. Here’s some screen shots of my script.code that I used to add location:
So I already have the plugin Location installed with values such as Woodbury and Edison.
I’m trying to get Powershell to just load my section from $location to location as seen below, but it’s not working despite I used the pscustomobject
I also tried adding location under $hostjson to see if this helps before as well.
-
Fog Location help via FOG API
Hello, all
I’m starting to get closer, but not sure what I’m missing. I read up on pscustomobject and I did the following in the script. So in the first screen shot, I got the member properties from get-foghost -hostname $machinename | get-member
The screenshot called “before”, doesn’t have the location field.
What I did was created a pscustomobject by creating a variable called $member
so $member = new-object -typename psobject
The screenshot I did later was called “after”
I then did $member | get-member and it added location as you can see in the screen shot.
In the parameter, I did location = Westbury for example. Here’s some screen shots of my script.code that I used to add location:
So I already have the plugin Location installed with values such as Woodbury and Edison.
I’m trying to get Powershell to just load my section from $location to location as seen below, but it’s not working despite I used the pscustomobject
-
RE: FOG API help
@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.
-
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.
-
RE: fog API powershell help
@jj-fullmer said in fog API powershell help:
$snapinsToRemove = @(‘snapin’,‘names’,‘here’);
That’s what I needed, an array to choose from a list. Thank you so much! Really appreciate you on helping me on this.
-
RE: fog API powershell help
@jj-fullmer said in fog API powershell help:
@jamaal I have a function for inventory here https://fogapi.readthedocs.io/en/latest/commands/Get-FogInventory/
It gets the same inventory information via powershell and adds it to fog.
I can also help you with queuing the native inventory task, but that might be a bit trickier. I think you can schedule more than one task for a machine when it’s a scheduled task, but I’m not sure.Glad I had the code for get-foggroups somewhere to be found. It looks like something weird happened to the get-foggroups function and all the code disappeared from it. I’ll need to get that fixed as soon as I can as that function is used all over the place. I have made an issue for it https://github.com/darksidemilk/FogApi/issues/3
Thanks jj, appreciate it. And another question. So I read in the fog forums and also the general fog page that snapins for groups don’t function, correct? I created a group called sales and when I added snapins to it, they never stayed. I then started reading up on it and said the groups only serve mostly as a category for naming& imaging purposes.
It would be create if there was a way to add snapins to groups so when the other technicians use Microsoft Forms for example, they select which group the pc will go to and then the pc will automatically have all the snapins.
If somehow that gets done in future, please let me know. Or do you know of a powershell command to add multiple snapins at once? Ex; the tech would click on the checkbox on Microsoft Form for more than one snapin, so I need to create a powershell statement to group more than one snapin.
-
RE: fog API powershell help
Ok, I think I got this figured out just now.
Thanks to you jj, I followed your example from your original link:https://forums.fogproject.org/topic/12026/powershell-api-module/11
So far I got this to work on one host: Here’s what I did by using your script:
$newAssocs = New-Object System.Collections.Generic.List[object];
$computer = (get-foghost -hostname “itloaner”).id
$groups = (get-fogobject -type object -coreobject group).groups | where-object name -eq “sales”
$groupAssocs = Get-FogObject -Type Object -CoreObject groupassociation$json = @{
“hostID”=$computer;
“groupID”=“$($groups.id)”;
} | ConvertTo-Json;
# Note, when creating the json splat and then piping it to convertto-json you must encapsulate properties and values in quotes and match the case of the original property (i.e. ID instead of Id) as in this example or it won’t parse right and will return a 417 error from the api$result = New-FogObject -type object -coreObject groupassociation -jsonData $json;
$NewAssocs.Add($result);#list the newassocs that added the laptops to your group
$NewAssocs;It then showed up as it added as per the results attached in this message.
For further proof, I went to my test host and verified it was added via the new-fogobject command. I’m starting to understand now how this works. I just need to keep playing around with it and should be good going forward.
My next task is to try to create a task via powershell to get the inventory of the machine before deploying the image. If you know of any commands, please let me know and I’ll keep trying myself as well.
Again thanks for the info.