Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP / File Shares Not Uploading to IT Glue #15

Open
firefox15 opened this issue Nov 5, 2018 · 8 comments
Open

DHCP / File Shares Not Uploading to IT Glue #15

firefox15 opened this issue Nov 5, 2018 · 8 comments

Comments

@firefox15
Copy link

Hey, thanks for these scripts. I know it's all volunteer time, so I do not want to act like you owe me any troubleshooting, but if you have a minute, I'm having an issue with the DHCP and file share scripts. The AD script works great--no issues there.

Basically, both scripts say they are running, but no information is uploaded to IT Glue. Are there any levels of verbose logging I can enable to try to troubleshoot this more?

File Shares flex asset configuration file found!
Users$
------
Organization Name:
Server: Server01
Share Name: Users$
Share Path: \\Server01\Users$
Share Description:
Disk Path: D:\users

@qcomer
Copy link

qcomer commented Dec 5, 2018

We are having the same problem

@skoefel
Copy link

skoefel commented Jan 9, 2019

Same here

@mettix
Copy link

mettix commented Apr 19, 2019

Same here -_-

@mettix
Copy link

mettix commented Apr 19, 2019

I got the solutions! I'll try to figure out how I can post an update.. :x

@mettix
Copy link

mettix commented Apr 19, 2019

https://github.com/mettix/automation/blob/master/File%20Shares/FileShares.ps1

Here I forked this thing, updated script is there.

@Absoblogginlutely
Copy link

I tried @mettix 's script to see if that would make a difference for me. The data displayed when the script is run looks correct (which is a big improvement over the original script) however I'm still getting
New-ITGlueFlexibleAssets : {"errors":[{"status":401,"title":"Unauthorized","detail":"Unauthorized resource
access","source":{"pointer":"id"}}]}
At C:\jobs\File Shares\FileShares.ps1:244 char:49

  • ... $api__output_data = New-ITGlueFlexibleAssets -data $api__body
  •                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-ITGlueFlexibleAssets

I am able to update the AD flexible asset, office365 etc using the sample file so I know write API access is working correctly

@Absoblogginlutely
Copy link

I got this working by changing some logic.
tldr - set Permissions to the notes field.

In my case, permissions is set not as a description field but a security group tag. As ITGlue expects a the permissions to be a tag, it generates the permission denied when sending free text to the Permissions tab.
I fixed this by setting my api_config-fileshares.psd1 to read as follows.
@{
org_id = '12345'
flexible_asset_type_id = '54321'

key_name_ShareName = 'share-name'
key_name_ShareDescription = 'share-description'
key_name_Server = 'servers'
key_name_SharePath = 'share-path'
key_name_DiskPath = 'disk-path'
#key_name_Permissions = 'required-security-group'
key_name_Permissions = 'notes'

}

The data was then quickly uploaded to ITGlue.
However, a similar issue occurs with the Servers field. I was kind of expecting this to be the text for the servername ie the computers hostname, but again this is a tag field so does not work. If I grab the servers id from the url and hard code it just before the set-itglueflexibleassets line, the update to ITGlue works.

What I did find in my testing is that right now it creates a new share every time the script is run instead of editing the existing share, AND there is no mass delete option in ITGlue to delete all the Flexible assets at once.
This is because the only checking is to see if an organization exists. If it does, then New-ITGlueFexibleAsset is called as opposed to checking if the asset exists and if it does then running a patch.
if(test-path $api) {
$api_config = Import-LocalizedData -FileName "$api"

                    Write-Host "File Shares flex asset configuration file found!" -ForegroundColor Green

                    $api__body = formatAPIData # format data for API call
                    ######$api__org_id = $api__body.data.attributes.organization_id
                    $api__org_id = $api__body.attributes.organization_id
                    $api__flex_asset_id = $api_config.flexible_asset_type_id
                   ##This is where i've hard coded the server number for now instead of using a server text value.

$api__body.attributes.traits.servers="19818167"
if($api__org_id) {
Write-Host "Creating a new flexible asset."
$api__output_data = New-ITGlueFlexibleAssets -data $api__body
}
}
else {
Write-Error "ERROR: File Shares flex asset configuration file was found. Please create one and re-run the script."
}

Still working on debugging this script..

@rlnenicka
Copy link

I am not great with powershell not going to lie, I am however pretty decent with VB so my solution was to simply run these with the -file argument and then wrote an exe to upload the output :) a little hacky i know but why reinvent the wheel since these pull the info i'm looking for (although i'm thinking I will just eliminate the need for them all together so a single exe is all that is needed, but who has the time, right lol). it will likely be a bit before i have a finished product but the core functionality is there, just needs to be prettied up. Once complete, I'd be happy to share if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants