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

    Fog Location help via FOG API

    FOG Problems
    1
    3
    92
    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

      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 Reply Quote 0
      • J
        Jamaal @Jamaal last edited by Jamaal

        @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
        • J
          Jamaal @Jamaal last edited by

          @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 Reply Quote 0
          • 1 / 1
          • First post
            Last post

          193
          Online

          10.4k
          Users

          16.4k
          Topics

          150.5k
          Posts

          Copyright © 2012-2023 FOG Project