• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. JJ Fullmer
    3. Posts
    • Profile
    • Following 5
    • Followers 4
    • Topics 55
    • Posts 957
    • Groups 3

    Posts

    Recent Best Controversial
    • RE: Disable snapin hashing

      Here is the code I use to create a snapin after publishing a chocolatey package to my repo.
      I added the hashes after the problem started and it sometimes helps but it seems the behavior is slightly unpredictable and the hash record on fog still changes somehow.

      
              Write-Verbose "making sure package $global:packageName exists as fog snapin";
              if ( (Invoke-FogApi -uriPath "snapin/search/$global:packageName" -Method GET).count -eq 0){
                  Write-Verbose "snapin does not exist, creating new snapin";
                  $snapinScript = Get-Item "path\to\chocoPkgSnapin.ps1";
                  $hash = ($snapinScript | Get-FileHash -Algorithm SHA512).Hash;
                  $fileSize = $snapinScript.Length;
                  $json = @{
                      "name"="$global:packageName"
                      "file"="chocoPkgSnapin.ps1"
                      "args"="-pkgname $global:packageName"
                      "reboot"=""
                      "shutdown"=""
                      "runwith"="powershell.exe"
                      "runwithArgs"="-ExecutionPolicy Bypass -NoProfile -File"
                      "protected"="0"
                      "isEnabled"="1"
                      "toReplicate"="1"
                      "hide"="0"
                      "timeout"="0"
                      "packtype"="0"
                      "storagegroupname"="default"
                      "hash"="$hash"
                      "size"="$fileSize"
                  } | ConvertTo-Json;
                  Invoke-FogApiChocoSnapin -uriPath 'snapin/new' -Method POST -jsonData $json -verbose;
              }
              else {
                  Write-Verbose "Snapin already exists";
              }
              Write-Verbose "Updating hases for all snapins";
              $snapinScript = Get-Item "path\to\chocoPkgSnapin.ps1";
              $hash = ($snapinScript | Get-FileHash -Algorithm SHA512).Hash;
              $fileSize = $snapinScript.Length;
              $snapins = Get-FogObject -type object -coreObject snapin;
              $snapins.snapins | Where-Object file -match 'choco' | ForEach-Object { $data = @{
                  "id" = "$($_.id)";
                  "name" = "$($_.name)";
                  "file" = "$($_.file)";
                  "runwith"="powershell.exe";
                  "runwithArgs"="-ExecutionPolicy Bypass -NoProfile -File";
                  "args" = "$($_.args)";
                  "protected"="0";
                  "isEnabled"="1";
                  "toReplicate"="1";
                  "hide"="0";
                  "timeout"="0";
                  "packtype"="0";
                  "reboot"="";
                  "shutdown"="";
                  "size"="$fileSize"
                  "hash" = "$hash";
              } | convertto-json; 
              Update-FogObject -type object -coreObject 'snapin' -IDofObject $_.id  -jsonData $data -uri "snapin/$($_.ID)/
              Write-Verbose 'Done!';
              return;
      

      Some of the snapins return 500 errors when I attempt to loop through them all and update their hash records.
      Since that isn’t working I’m really hoping there’s some way to disable the hashing function, even if it’s some hackish way in the database or something.

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: FOG API AD JSON Settings

      @RobTitian16

      I realize this is a few month’s old. But you might want to check out and or contribute to the fog module I have in git and published in the powershellgallery, there’s a forum post with more info here https://forums.fogproject.org/post/120746
      Also did you have a chance to try the code I posted back in september and see if that worked? Because it works for me.
      And looking again at your code I would ask what the value of $useAD is, is it 1 it should be 1. And I would also try piping the object into convertto-json, I’ve had better luck with that, I think it parses it different i.e. $CreateHostJson = $HostJson | ConvertTo-Json I would also encapsulate everything in quotes on the splat.
      The only other thing that might be an issue is the ADPass. When you get the password via the api it is returned in plain text (because you already authenticated with api keys, so it’s not like just anyone can grab it). When you input the password in the gui you put it in plaintext and it encrypts when you hit save, I don’t think the same thing happens if you set it through the api. My solution has been to always enable the default AD settings when adding a host via the gui or the pxe menu. But it sounds like you’re adding the host through the api. The “useAD”=“1” in the json should be causing the checkbox for the ‘join domain after deploy’ to be checked. Sadly when you check it from the api it doesn’t pull the default domain settings. You might try creating the host without the AD settings and then sending just the AD settings in an update/put command. If you copy paste the already encrypted password from a working host in the gui, that might do the trick as it seems to pass whatever you put in that field to be in plaintext.

      So point is, try adding the domain stuff with an update api command after creating. And use the code I have in the example to help if needed.

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: Powershell API Module

      @UWPVIOLATOR

      Getting available host properties/parameters

      Well first for your question on the attributes I think it’s because of what the api returns. For example

      $hostObj = Get-FogObject -type Object -CoreObject host
      $hostObj;
      # You would see a count column with a count of all your hosts and a hosts column with a hash table object
      # if you then set a variable to the hosts object in the return object, you'll get what you're looking for. You could also do it with select-object by doing | select-object -expandproperty hosts | select-object *
      $hosts = $hostObj.hosts;
      # I'm removing some information from this output
      $hosts | get-member; #note get-member has an alias of gm which is what I typically use instead, save those keystrokes!
      
      
         TypeName: System.Management.Automation.PSCustomObject
      
      Name         MemberType   Definition
      ----         ----------   ----------
      Equals       Method       bool Equals(System.Object obj)
      GetHashCode  Method       int GetHashCode()
      GetType      Method       type GetType()
      ToString     Method       string ToString()
      ADDomain     NoteProperty string ADDomain=
      ADOU         NoteProperty string ADOU=
      ADPass       NoteProperty string ADPass=
      ADPassLegacy NoteProperty string ADPassLegacy=
      ADUser       NoteProperty string ADUser=
      biosexit     NoteProperty string biosexit=
      building     NoteProperty string building=0
      createdBy    NoteProperty string createdBy=jmin
      createdTime  NoteProperty string createdTime=2016-02-25 14:43:30
      deployed     NoteProperty string deployed=0000-00-00 00:00:00
      description  NoteProperty string description=192.168.100.102
      efiexit      NoteProperty string efiexit=
      enforce      NoteProperty string enforce=1
      hostalo      NoteProperty System.Management.Automation.PSCustomObject hostalo=@{id=; hostID=; time=}
      hostscreen   NoteProperty System.Management.Automation.PSCustomObject hostscreen=@{id=; hostID=; width=800; he...
      id           NoteProperty string id=83
      image        NoteProperty System.Management.Automation.PSCustomObject image=@{imageTypeID=; imagePartitionTypeID=; i...
      imageID      NoteProperty string imageID=0
      imagename    NoteProperty string imagename=
      init         NoteProperty string init=
      inventory    NoteProperty System.Management.Automation.PSCustomObject inventory=@{id=; hostID=; primaryUser=; other1...
      ip           NoteProperty string ip=
      kernel       NoteProperty string kernel=
      kernelArgs   NoteProperty string kernelArgs=
      kernelDevice NoteProperty string kernelDevice=
      macs         NoteProperty Object[] macs=System.Object[]
      name         NoteProperty string name=
      pending      NoteProperty string pending=
      pingstatus   NoteProperty string pingstatus=<i class="icon-ping-down fa fa-exclamation-circle red" data-toggle="tool...
      primac       NoteProperty string primac=
      printerLevel NoteProperty string printerLevel=1
      productKey   NoteProperty string productKey=
      pub_key      NoteProperty string pub_key=
      sec_time     NoteProperty string sec_time=0000-00-00 00:00:00
      sec_tok      NoteProperty string sec_tok=
      useAD        NoteProperty string useAD=
      
      

      You’ll notice that some of the return values are objects and custom objects. These have even more sub fields that can be referenced.
      A quick note though, in the newer not yet released to the master branch of the api, and @Tom-Elliott can correct me if this is no longer the case or something, the name of the property will become universal for each coreobject type. i.e right now you get hosts and then go into the hosts property, if you got groups it would be a groups property. The new version (that I believe is available in the working branch of the fogproject git along with a new ui/Fog 1.6) will have one name for all those properties. So if creating custom scripts around this try to make it modular so that you can find where you went into coreobject returns and change them to the new universtal property name (I can’t remember what its called right now).

      Using For-EachObject and Where-Object to do magic

      notes on foreach vs foreach-object

      So you can indeed do some foreach stuff, but know that you can get weird behavior in powershell if you use an objects .ForEach({}) member function vs piping the object into a ForEach-Object command (which has an alias of % ie $hosts | % {do stuff}). see this link for more detail on what I think is the related reason for this, but I’m not 100%, but I do know it’s different between the two.

      Find the laptops

      So lets look at putting all the laptops in a To Be Image Group (Which I’m going to assume already exists). First thing you need to know is how you would identify the laptops from the information in the system. i.e. are they all the same model and have they all been imaged or at least inventoried in fog already? There is a systype field captured in inventory that might work. You could also utilize sysproduct if they are all the same model or have a list of models (you would use -in instead of where -match is in this example and put the list of strings in an @('array','of','model','names') I believe). You could also do this with the name property if you happen to have named them in a way to test against. But for this example we’re going to assume all laptops have the systype of ‘Notebook’

      #Put all the hosts in an object, since you were using select-object in your question I'll do it in that style for the example
      $hosts = Get-FogObject -type Object -CoreObject host | Select-Object -ExpandProperty hosts;
      # Find all the hosts where the property of systype in inventory matches notebook
      $laptops = $hosts | Where-Object { $PsItem.inventory.systype -match 'Notebook' }
      # note the shorthand/alias version of above would be $hosts | ? { $_.inventory.systype -match 'Notebook' }
      

      The new laptops object would have a foreach member ie $laptops.ForEach({code on each $_}) but that member function works best with a single property of an object as it processes the code in a different order, I think it’s related to begin {} process {} end {} blocks that I linked earlier. So I strongly suggest using foreach-object instead of $laptops.foreach({do stuff});

      Get the group

      Before we loop though we should get the information for the group you want to add to. I’m going to be inconsistent in how I nest into the property, I recommend consistency, just want to demonstrate the many ways you can access the property instead of assuming all readers of this just know all the ways. In this instance I am also assuming that the group already exists. You could also create the group with the api, but this answer is already too long and it can be hopefully figured out with these examples if it’s needed.

      $groups = (Get-Fogobject -type Object -CoreObject group).groups
      $group = $groups | ? name -match 'To Be Image'
      

      Working with group associations

      Now to add hosts to a group (or to see what groups they’re in) you’ll want the groupassociation object, here’s a little extra example on how it is used
      There is a group association for every host to group connection. There are just 3 properties, the id of the association, the id of the host and the id of the group

      $groupAssocs = Get-FogObject -Type Object -CoreObject groupassociation
      $groupAssocs = $groupAssocs.GroupAssociations;
      

      Now you have an object with all the group associations and you can do some fun stuff with it

      Find and output all hosts in a group

      Here’s an example of how you could find all the hosts currently in the group found earlier

      $hostIdsInGroup = $groupAssocs | ? { $_.GroupID -match $group.id } | Select-Object -ExpandProperty HostId;
      #convert the ids into an object with all the full hosts objects in it
      $hostsInGroup = $hosts | ? id -in $hostIdsInGroup # or $hosts | ? { $hostIdsInGroup -contains $_.id }
      # then list the findings in the console with just the host names
      Write-Host "Hosts in the group $($Group.name) `n $($hostsInGroup.name | Out-String)" 
      

      out-string isn’t 100% needed there just wanted to use it in an example as it is helpful when wanting to output multiple properties of an object in a write-host command

      Getting all groups a host is a member of

      If you wanted all groups a specific host is a member of, lets say the last laptop in that laptop object ([-1] grabs the last object in an array)…

      $hostInGroups = $laptops[-1];
      $groupIdsInHost = $groupAssocs | ? { $_.hostID -match $hostInGroups.id } | Select-Object -ExpandProperty groupID;
      $groupsWithHost = $groups | ? { $groupIdsInHost -contains $_.id }
      #now list the findings
      Write-Host "Groups the host $($hostInGroups.name) belongs to `n $($groupsWithHost.name | Out-String)"
      

      Removing all hosts from a group

      Now lets say you wanted To Be Image to be empty before adding, lets remove all hosts in that group, which we already found and have stored in $hostIdsInGroup
      we first get the full group associations object (since we grabbed the variable with a piped selectobject we only have the one property in memory) and send a delete to each of the matching associations

      $groupAssocsToDelete = $groupAssocs | ? { $_.GroupID -match $group.id } # or $groupAssocsToDelete = $groupAssocs | ? hostID -in $hostsIdsInGroup;
      # loop through and start deleting
      $groupAssocsToDelete | ForEach-Object {
          Remove-FogObject -type object -coreObject groupassociation -IdOfObject $_.id;
      }
      

      alternatively this might work too without looping, but not sure that the api supports this or not

      $json = $groupAssocsToDelete | ConvertTo-Json;
      Remove-FogObject -type object -coreObject groupassociation -jsonData $json
      

      Adding hosts to a group

      And finally at long last the answer to your actual question…
      add all the laptops to the group and store the results in a list (because I like being able to reference what happened in my loop, and also list objects are cool because you cad .add($stuff) and .Remove($stuff) with simple methods)

      $newAssocs = New-Object System.Collections.Generic.List[object];
      $laptops | ForEach-Object {
          $json = @{
              "hostID"="$($_.id)";
              "groupID"="$($group.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;
      

      Making sure it worked

      Now you can go look in the gui to see the hosts are now in the group or you can use the method from earlier to output it in the console.

      #you'll want to refresh the groupassocs variable because they have changed and then the rest is the same
      $groupAssocs = Get-FogObject -Type Object -CoreObject groupassociation
      $groupAssocs = $groupAssocs.GroupAssociations;
      $hostIdsInGroup = $groupAssocs | ? { $_.GroupID -match $group.id } | Select-Object -ExpandProperty HostId;
      #convert the ids into an object with all the full hosts objects in it
      $hostsInGroup = $hosts | ? id -in $hostIdsInGroup # or $hosts | ? { $hostIdsInGroup -contains $_.id }
      # then list the findings in the console with just the host names
      Write-Host "Hosts in the group $($Group.name) `n $($hostsInGroup.name | Out-String)" 
      

      Concluding ramblings

      One day in the future I hope to magically have time to update the module with helper functions to make some of these kinds of things easier. But I am yet to be able to find that time sadly. Although I suppose I do have the code written here now for some of the helper functions like Add-HostToGroup, Remove-HostFromGroup, Get-HostsInGroup, Get-GroupsInHost/get-HostMembership, get-fogHosts, get-fogGroups, get-FogGroupByName. But at least it is possible to do all those things with the existing commands, those would just be easier, but then you wouldn’t get to learn how to create them yourselves, and where’s the fun in that?

      I hope these examples help and that I didn’t give too much information.

      Edit: Edited post to have headings and separated the code segments so that more people can more easily find answers to other possible questions

      posted in Tutorials
      JJ FullmerJ
      JJ Fullmer
    • RE: Windows Boot Manager boot option disappears after Image

      Another question. When imaging what do you set the default boot option to?
      i.e. do you change the boot order to network/pxe first, or are you leaving it default and hitting f12 to get to the network boot?

      I change my boot order then when it boots after imaging, if fog didn’t change the boot order it’ll still boot through the fog refind boot to disk menu.
      Then my set-bootmgr function comes into play. Before getting into that though (which involves a bit of setup by the by, a bit of configuration on the fog server end and a bit of configuration on the unattend and files included in your image)

      But I’m curious if booting through the pxe boot after imaging will get you into an automated process to start out.

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: Windows Boot Manager boot option disappears after Image

      @ConJon Looks like you’ve got it set up as

      generalize - > upload
      deploy -> specialize -> oobe

      I’m looking through my generalize and audit system configs to see if there’s anything that might be helping me out with the boot changes. On most my hp computers the boot manager changes in the boot order automatically. We have a few outliers once in a while that don’t change after the fog deploy, like some acer switch 3/5 tablets.

      What model exactly is this happening on again?
      It looks like you just said prodesk, but there is a prodesk 400 and a prodesk 600. There are also different generations and different form factors and that can make a difference too. I have some prodesk 400’s and 600’s of the mini formfactor in G3 and g4 I can test against to see if I can give you a working example

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: Windows Boot Manager boot option disappears after Image

      @ConJon Hmmm, do you happen to know how your sysprep unattend is configured as far as boot phases?
      i.e. ours goes like this (super simplified summary)

      Capture:

      Install Windows -> ctrl+shift+f3 to enter audit mode from oobe screen - > add customizations -> Run sysprep /audit /reboot /unattend:unattendfile
      -> sysprep Audit System phase -> sysprep Audit User phase -> sysprep Generalize phase -> Shutdown -> Upload to fog

      Deploy :

      Fog images the machine -> sysprep specialize phase -> sysprep oobe phase -> firstlogoncommands/custom provisioning/snapins etc.

      In our case the uefi boot options/order change I believe either during the specialize or oobe phase when it creates the windows boot manager option. I then have a function in my custom provisioning that makes refind the default boot manager. I might have details on that elsewhere in the forum, can dig them up if you’re interested in using refind as a default boot manager. It’s a fun solution that also makes booting to fog or the uefi firmware settings much easier.

      Granted @Sebastian-Roth’s solution of fixing it within fog is better.

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: Windows Boot Manager boot option disappears after Image

      I might have some ideas to help with this, a couple questions though…

      • Do you use sysprep when capturing and deploying images?
      • Does the change happen right after fog imaging completes or after a successful boot?
      • Are you capturing from a vm or a physical machine?
      • Are you using UEFI or Legacy/bios/mbr mode for your image?
      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • Disable snapin hashing

      Would like to disable snapin hashing

      The way I use snapins, I have one script that takes arguments. The script essentially makes either a interactive or background scheduled task to install a chocolatey package given in the parameters to the script. The script is simple and it works, and really I don’t even need it included with the snapins because I have it installable from an internal powershell repo and could just have the snapin tool run a powershell command. But a snapin currently requires a file, and that file has a hash, and checking it seems to be required. Somehow my hash keeps changing, so I want to disable the hash checking.

      The scenario in more detail

      So all my snapins use the same powershell script. This script hasn’t changed in some time. However, somehow the hash keeps changing when I try to deploy snapins. I have some automations in place using the api that make my snapins for me and I’ve tried many things to try and ensure the hash is right. However I have found that if I try to create a new snapin with a ‘snapin file exists’ setting it gets the wrong hash. Or if I do it with the api, the has doesn’t match. I even make it so every time I push a snapin through the api it re-uploads the powershell script, grabs the hash of the uploaded script and updates the hash value in the database for every snapin. But it still doesn’t stick 100%.

      Easiest solution

      While it is possible that there’s something I’m doing somewhere that keeps causing the hash to change. I would find it much easier for my environment to disable the hashing. The hash check is a cool feature, and I remember when it was being added for cases where people have large files they’re sending in a snapin and want to make sure the whole file downloaded. But I’m sending one tiny script file of a few kb that doesn’t change. Since it’s somehow changing, I’d like the option to just disable that feature for my purposes. So I’m wondering if there’s any easy way that’s built in that I don’t know about. Or if I have to go into the database and change something, or some setting file on the server or if I have to recompile the client installer to have a custom client that doesn’t do snapin hashes. I’m willing to do what it takes, just need a little help.

      Environment

      Fog Server 1.5.5
      Cent OS 7 x64
      Client version 0.11.16

      Please and thank you 😃

      posted in FOG Problems snapins client
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth I do still have it on hand if you have any new ideas. I just ended up going through my image prep process with a fresh install of windows as if I was making the image on this computer. It was much much slower of course, but it worked. This one in particular has been deployed now, but if we have something promising I could probably pull it back from production and give the user something else in the interim.

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: FOG API AD JSON Settings

      @mparlette Why thank you good sir 😃
      I keep meaning to update some pieces of that module but keep not having time.

      But anyway, I have been using the api via powershell for AD stuff since I made it

      I don’t have time to delve deep into an explanation right now but here’s a quick code example that I use to create an OU string based on the fog group name and then add the domain join info. It doesn’t all use my api as it and could use some optimization but it works as it is so I haven’t updated it yet. But the invoke-fogapi command I believe is the same as in the module published in the powershell gallery. So it can work together.

      Though another quick note, it looks like the OP’s error message is saying AD is disabled on the server. Make sure that it isn’t actually disabled. YOu can also try resetting the encryption data on the client.

      function Set-FogOU {
          [CmdletBinding()]
          param (
              [string]$jsonData,
              $hostObj,
              [string]$OUstr
          )
      
          begin {
              if($null -eq $hostObj) {
                  Write-Verbose 'no host given, getting current host...';
                  $hostObj = Get-FogHost
              }
              Write-Verbose 'getting fog group...';
      
              $group = Get-FogGroup $hostObj.id;
      
      
              if ($group.name -match 'wks' -OR $group.name -match 'TS') {
                  if ($null -eq $OUstr -OR $OUstr -eq "") {
                      Write-Verbose 'checking if group is domain group'
                      $OUstr = Get-OUStr -group $group;
                  }
                  Write-Verbose "OU string is $OUstr, setting to properties of host object, also enabling and enforcing domain join...";
                  $hostObj.ADOU = $OUstr;
                  $hostObj.useAD = 1;
                  $hostObj.enforce = 1;
              }
              else { #group name doesn't have wks in it so don't join the domain
                  Write-Verbose "Group name $($group.name) is not a domain group, setting fog to not join the domain, but still restart to name the computer...";
                  $hostObj.ADOU = "";
                  $hostObj.useAD = 0;
                  $hostObj.enforce = 1;
              }
      
              Write-Verbose 'creating json string from new host ou settings...';
              $jsonData = $hostObj | Select-Object id,ADOU,useAD,enforce | ConvertTo-Json;
          }
      
          process {
              Write-Verbose "Setting $($hostObj.name)'s OU settings to $jsonData";
              $newHost = Invoke-FogApi -Method 'Put' -uriPath "host/$($hostObj.id)/edit" -jsonData $jsonData;
          }
      
          end {
              Write-Verbose "OU and AD settings have been set for $($newHost.name)";
              Write-Verbose 'host settings are now...';
              $newHost | Select-Object id,name,ADOU,useAD,enforce
              return;
          }
      }
      
      function Get-OUStr {
          [CmdletBinding()]
          param (
              $group,
              $OUstr = ''
          )
      
          begin {
              # $OUstr = "";
              Write-Verbose "getting OUstring for group $($group.name)";
          }
      
          process {
              if ($group.name -match 'wks' -OR $group.name -match 'TS') {
                  Write-Verbose 'group should be in an OU, creating OU string from group name or using given string...';
                  if ($null -ne $OUstr -AND $OUstr -ne "") {
                      Write-Verbose 'using given ouString'
                      $OUstr = $OUstr;
                  }
      
                  else {
                      Write-Verbose 'creating wks ou string';
                      $OUstr = "OU=$($group.name),OU=Desktop,OU=Workstations,DC=domain,DC=com";
                  }
                  Write-Verbose "OU string is $OUstr, setting to properties of host object, also enabling and enforcing domain join...";
              }
          }
      
          end {
              return $OUstr;
          }
      }
      
      function Get-FogHost {
          [CmdletBinding()]
          param (
              [string]$uuid,
              [string]$hostName,
              [string]$macAddr
          )
      
          begin {
              [bool]$found = $false;
              Write-Verbose 'Checking for passed variables'
              if (!$uuid -and !$hostName -and !$macAddr) {
                  Write-Verbose 'no params given, getting current computer variables';
                  $uuid = (Get-WmiObject Win32_ComputerSystemProduct).UUID;
                  $macAddr = ((Get-NetAdapter | Select-Object MacAddress)[0].MacAddress).Replace('-',':');
                  $hostName = $(hostname);
              }
              Write-Verbose 'getting all hosts to search...';
              $hosts = (Invoke-FogApi).hosts;
              Write-Verbose "search terms: uuid is $uuid, macAddr is $macAddr, hostname is $hostName";
          }
      
          process {
              Write-Verbose 'finding host in hosts';
              [bool]$found = $false;
              $hostObj = $hosts | Where-Object {
                  ($uuid -ne "" -AND $_.inventory.sysuuid -eq $uuid) -OR `
                  ($hostName -ne "" -AND $_.name -eq $hostName) -OR `
                  ($macAddr -ne "" -AND $_.macs -contains $macAddr);
                  if  ($uuid -ne "" -AND $_.inventory.sysuuid -eq $uuid) {
                       Write-Verbose "$($_.inventory.sysuuid) matches the uuid $uuid`! host found";
                       $found = $true;
                  }
                  if ($macAddr -ne "" -AND $_.macs -contains $macAddr) {
                      Write-Verbose "$($_.macs) matches the macaddress $macAddr`! host found";
                      $found = $true;
                  }
                  if  ($hostName -ne "" -AND $_.name -eq $hostName) {
                      Write-Verbose "$($_.name) matches the hostname $hostName`! host found";
                      $found = $true;
                  }
              }
      
          }
      
          end {
              if ($found){
                  return $hostObj;
              }
              return $found; #return false if host not found
          }
      }
      
      function Get-FogGroup {
          <#
          .SYNOPSIS
          needs to return the group name of the group that isn't the everyone group
          will use groupassociation call to get group id then group id to get group name from group uriPath
      
          .DESCRIPTION
          requires the id of the host you want the groups that aren't the everyone group for
          #>
          [CmdletBinding()]
          param (
              [int]$hostId
          )
      
          begin {
              [bool]$found = $false;
              Write-Verbose 'Getting all fog group associations...';
              $groupAssocs = (Invoke-FogApi -uriPath groupassociation).groupassociations;
              Write-Verbose 'Getting all fog groups...';
              $groups = (Invoke-FogApi -uriPath group).groups;
          }
      
          process {
              Write-Verbose "Finding group association for hostid of $hostId";
              $hostGroups = $groupAssocs | Where-Object hostID -eq $hostId;
              Write-Verbose "filtering out everyone and touchscreen group";
              $hostGroups = $hostGroups | Where-Object groupID -ne 3; #groupID 3 is the everyone group, don't include that
              $hostGroups = $hostGroups | Where-Object groupID -ne 11; #groupID 11 is the wkstouchscreens group, don't include that either
      
              Write-Verbose "finding group that matches group id of $hostGroups...";
              $group = $groups | Where-Object id -eq $hostGroups.groupID;
              Write-Verbose 'checking if group was found...';
              if($null -ne $group -AND $group -ne "") { $found = $true; Write-Verbose 'group found!'}
          }
      
          end {
              if($found){
                  return $group;
              }
              return $found;
          }
      }
      
      Set-FogOU -verbose
      
      

      Hope that helps

      posted in FOG Problems
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth Gotta love how reflective this computer’s screen is…Took a picture of the debug output
      https://photos.app.goo.gl/mVL8zAGAi9PN2sNc7

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: Update-FogObject / Powershell module use

      @mparlette Also, also, thank you for using my module! I’m glad to see that others are finding use of it!
      Also also also, another failsafe is to just run commands through invoke-fogapi if the other functions aren’t working. It requires a bit more understanding of the uri paths and using the api. But all the other functions are really just helper functions that make it easier to call that one master function. It’s also the function that actually has some info in it if you run help invoke-fogapi -full

      posted in General
      JJ FullmerJ
      JJ Fullmer
    • RE: Update-FogObject / Powershell module use

      @mparlette also, ps. If you run that same code with a -verbose on update-fogobject you’ll get a lot more information.

      Another quick update is that I’m also working on a better settings system where the module’s saved settings are stored in the fog service program file folder so that they aren’t overridden when you update the module.

      All of these updates may take a while to get done and published as I have a lot of other projects at the moment and I tend to put my work in an internal git repo and just publish stable things to the fog community git and psgallery.

      If you’re in a bit of a rush and are ok with beta code to play with, I can zip up my current working version and post it here

      posted in General
      JJ FullmerJ
      JJ Fullmer
    • RE: Update-FogObject / Powershell module use

      @mparlette I just saw this and just today was finding some issue with Update-fogobject
      The issue appears to be with the dynamic parameter variable I have in the function for the coreobjecttype.
      For some reason it is working when you call the function and brings up all the coreobject type choices but then the variable is being set to null when the function is running.
      Meaning that when function builds the uri it only gets
      http://fogserver/fog//id/edit
      instead of
      http://fogserver/fog/coreObjectType/id/edit

      So one workaround I will try to publish by the end of the day is adding an optional uri parameter to that function so that you can manually override it when neccesarry.
      Also I should really add more documentation to each of the functions instead of just having it all under Invoke-fogapi

      I also will add a try/catch block to invoke-fogapi for when invoke-restmethod fails and have it try invoke-webrequest.

      posted in General
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth Sadly it just hung as well. Thanks for giving it a try though, I know compiling a kernel isn’t a 2 second process.

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth I also tried various old kernels from the fog kernel update (giving them different names of bzImage of course) non of which worked but had either similar errors or just hung.
      So a special kernel is greatly appreciated.

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth Here is the full inventory that fog got on the tabtop

      System Manufacturer HP
      System Product HP Convertible x360 11-ab0XX
      System Version Type1ProductConfigId
      System Serial Number CND6381606
      System UUID 75d38b44-b570-e611-b27e-98e7f4db4d7f
      System Type Type: Notebook
      BIOS Vendor Insyde
      BIOS Version F.14
      Motherboard Manufacturer HP
      Motherboard Product Name 82E1
      Motherboard Version 13.16
      Motherboard Serial Number PGDJPF21U41RCZ
      Motherboard Asset Tag Type2 - Board Asset Tag
      CPU Manufacturer Intel® Corporation
      CPU Version Intel® Celeron® CPU N3060 @ 1.60GHz
      CPU Normal Speed Current Speed: 1600 MHz
      CPU Max Speed Max Speed: 1660 MHz
      Memory 3.69 GiB
      Hard Disk Model
      Hard Disk Firmware
      Hard Disk Serial Number
      Chassis Manufacturer Hewlett-Packard
      Chassis Version
      Chassis Serial Chassis Serial Number
      Chassis Asset <BAD INDEX>

      edited
      So no it’s not an HP x2 210 tablet, but I wouldn’t doubt it’s got enough similarity to have the same problem being an HP x tablet.

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth

      0_1539199407022_1010181319a.jpg

      0_1539199432523_1010181319b.jpg

      0_1539199386014_1010181319d.jpg

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      Re watching the video I can see that you can’t really read any of the output as I set the resolution lower to be able to upload it faster. I’ll take some pictures of the output and post them shortly so you can actually read the error messages.

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • RE: HP Stream 11 x360 (HP 11-ab00x) Hangs after init.xz

      @Sebastian-Roth I suppose a kernel problem makes more sense than an efi boot file.
      I gave your kernel a try, thanks for that, sadly it did not work and gave me a kernel panic. However it did get past that initial hang.
      Here’s a video
      https://photos.app.goo.gl/1QTpmhz5syBno2eE6

      posted in Hardware Compatibility
      JJ FullmerJ
      JJ Fullmer
    • 1 / 1