• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Fog Location help via FOG API

Scheduled Pinned Locked Moved
FOG Problems
1
3
529
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jamaal
    last edited by Jamaal Mar 28, 2022, 4:24 AM Mar 28, 2022, 10:21 AM

    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.

    before.PNG

    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”
    after.PNG

    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.

    parameters.PNG

    code that I used to add location:
    location.PNG

    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
    accomplish.PNG

    J 1 Reply Last reply Mar 28, 2022, 10:49 AM Reply Quote 0
    • J
      Jamaal @Jamaal
      last edited by Mar 28, 2022, 10:49 AM

      @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.

      before.PNG

      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”
      after.PNG

      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.

      parameters.PNG

      code that I used to add location:
      location.PNG

      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
      accomplish.PNG

      I also tried adding location under $hostjson to see if this helps before as well.
      hostjson.PNG

      J 1 Reply Last reply Mar 29, 2022, 12:49 PM Reply Quote 0
      • J
        Jamaal @Jamaal
        last edited by Jamaal Mar 29, 2022, 6:54 AM Mar 29, 2022, 12:49 PM

        @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.

        before.PNG

        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”
        after.PNG

        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.

        parameters.PNG

        code that I used to add location:
        location.PNG

        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
        accomplish.PNG

        I also tried adding location under $hostjson to see if this helps before as well.
        hostjson.PNG

        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.
        location.PNG

        and after:

        location2.PNG

        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.

        pscustomobject location.PNG

        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.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post

        164

        Online

        12.2k

        Users

        17.4k

        Topics

        155.5k

        Posts
        Copyright © 2012-2024 FOG Project