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