automation
automation copied to clipboard
DHCP Script doesn't update config file or ITGlue
I've just started to test the scripts, the Active directory script works well.
But when I run the DHCP script , it outputs the correct information to screen but I've found that the $api variable isn't initiated.
I've added it to the parameters section which got past that but now I'm getting Method invocation failed because [System.Net.IPAddress] does not contain a method named 'op_Addition'. \DHCP\DHCP.ps1:121 char:5
I'm not great with powershell so any help appreciated.
I have not invested time in the DHCP script yet, hopefully Caleb can assist with it before I can get around to it.
If I have time before Christmas I will take a look at it.
On December 20, 2017 9:16:29 PM EST, globier [email protected] wrote:
I've just started to test the scripts, the Active directory script works well.
But when I run the DHCP script , it outputs the correct information to screen but I've found that the $api variable isn't initiated.I've added it to the parameters section which got past that but now I'm getting Method invocation failed because [System.Net.IPAddress] does not contain a method named 'op_Addition'. \DHCP\DHCP.ps1:121 char:5
I'm not great with powershell so any help appreciated.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/itglue/automation/issues/3
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Hey Globier,
I'll take a look tonight.
Out of curiosity, what version of PowerShell are you using, and on what
operating system? You can find your PS version by opening a terminal and
typing $PSVersionTable.PSVersion
.
On Wed, Dec 20, 2017, 9:17 PM arpeake [email protected] wrote:
I have not invested time in the DHCP script yet, hopefully Caleb can assist with it before I can get around to it.
If I have time before Christmas I will take a look at it.
On December 20, 2017 9:16:29 PM EST, globier [email protected] wrote:
I've just started to test the scripts, the Active directory script works well. But when I run the DHCP script , it outputs the correct information to screen but I've found that the $api variable isn't initiated.
I've added it to the parameters section which got past that but now I'm getting Method invocation failed because [System.Net.IPAddress] does not contain a method named 'op_Addition'. \DHCP\DHCP.ps1:121 char:5
I'm not great with powershell so any help appreciated.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/itglue/automation/issues/3
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/itglue/automation/issues/3#issuecomment-353247543, or mute the thread https://github.com/notifications/unsubscribe-auth/AGx9-vYDhec74E8KvKvQAOfNSQKckFwtks5tCc3bgaJpZM4RJRB7 .
I've made sure I updated so Major Minor Build Revision
5 1 14409 1005
Thanks Guys
Server 2012 R2
Hey Globier,
I just wanted to chime in and say that I haven't forgotten this. I was out earlier in the week for Christmas, but am back now.
I found some aspects of the script could be executed better and in a way that hopefully is more compatible. I'm rewriting the script completely and will send it your way after testing.
On Wed, Dec 20, 2017, 9:37 PM globier [email protected] wrote:
Server 2012 R2
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/itglue/automation/issues/3#issuecomment-353250000, or mute the thread https://github.com/notifications/unsubscribe-auth/AGx9-jrrHw6eM879kjF6qMYuD4N_XrfRks5tCdKHgaJpZM4RJRB7 .
Hello, Is this supposed to be functioning correctly yet? Mine displays all the correct scopes and stuff but doesn't update ITG.
Thanks in advance.
I get the same problem.
@globier @jhill777 @Andrewconcisemsp change the $api__body from $api__body = @{ data = @{ type = "flexible_assets" attributes = @{ organization_id = $api__org_id flexible_asset_type_id = $api_config.flexible_asset_type_id traits = @{ $api__key_name_ScopeName = $Name $api__key_name_Server = $api__Server_id $api__key_name_ScopeBounds = $Start + "-" + $End } } } }
to.... $api__body = @{ data = @{ type = "flexible_assets" attributes = @{ organization_id = $api__org_id flexible_asset_type_id = $api_config.flexible_asset_type_id traits = @{ $api__key_name_ScopeName = $Name $api__key_name_Server = $api__Server_id $api__key_name_ScopeBounds = "$Start-$End" } } } }
its the $api__key_name_ScopeBounds line causing the error, the + signs
@dmiller90 thanks for that. I Still get the same issue. It finds the correct information and display's it but then never updates IT Glue.
@Andrewconcisemsp can you send me the error you are seeing
Hi @dmiller90 thanks for replying. I do not get an error. It runs ok, shows all the relevant information as seen below but then never updates the flexible asset. See powershell commands and all relevant files attached also. api_config-DHCP.zip
Let me know if you need anything else.
@Andrewconcisemsp Do you have a flex asset type for DHCP? i dont see the ID in your config file nor do i see one listed?
Or are you trying to post this info under your AD asset type? If so fill in flexible_asset_type_id = '' with flexible_asset_type_id = '412206168932595' in your config file
Daniel
Hi @dmiller90 Apologies for the delay in getting back to you. I am putting it into the AD Asset Type. I filled in the ID and the asset still does not get updated. I have also filled in the correct org_id manually and still get the same problem. It finds all the relevant information but the flexible asset never gets updated. Andrew
I think two thinks are missing in the code:
[string]$api = "", and change $api__key_name_ScopeBounds = $Start + "-" + $End to $api__key_name_ScopeBounds = "$Start-$End" so dmiller says.
But with these changes there is no error on the script, but the information is not updating in IT Glue