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

Issues when running script #7

Open
smjb90 opened this issue Apr 27, 2018 · 11 comments
Open

Issues when running script #7

smjb90 opened this issue Apr 27, 2018 · 11 comments
Assignees

Comments

@smjb90
Copy link

smjb90 commented Apr 27, 2018

ITGlue & PowerShell Noob... Please Help!

Hey Guys,
Please see the below; Im not sure whats wrong an i'm now going round in circles.

Duplicate keys '' are not allowed in hash literals.
At C:\Users\Administrator\desktop\ActiveDirectory.ps1:200 char:21

  •                 $api__key_name_ADFunctionalLevel = $ADFunctionalLevel
    
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Collections.Hashtable:Hashtable) [], RuntimeException
    • FullyQualifiedErrorId : DuplicateKeyInHashLiteral

Invoke-RestMethod : {"errors":[{"status":"forbidden","title":"Cannot index flexible assets without providing a flexible asset type ID filter","source":{"pointer":null}}]}
At C:\Program Files\WindowsPowerShell\Modules\ITGlueAPI\Resources\FlexibleAssets.ps1:67 char:20

  • $rest_output = Invoke-RestMethod -method 'GET' -uri ($ITGlue_Base_URI + $res ...
    
  •   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
    
@CalebAlbers
Copy link
Collaborator

Hi @smjb90,

Thanks for reaching out! It appears that $ADFunctionalLevel and some other variable is not being filled out properly. Would you be able to run the command (Get-ADForest).ForestMode and let me know what the output is?

Would you also mind checking your configuration file to see what value is set in key_name_ADFunctionalLevel = "...."? It appears that perhaps your config file got overwritten, or something else happened such that the script is unable to properly read and parse the parameters in the configuration file.

@CalebAlbers CalebAlbers self-assigned this Apr 29, 2018
@smjb90
Copy link
Author

smjb90 commented Apr 30, 2018

Thanks. When running Get-ADForest).ForestMode i get the returned value.
Windows2003Forest

@{

flexible_asset_type_id = '570897686905070'

key_name_ADForestName = 'forest-name'
key_name_DomainName = 'domain-full-name'
key_name_DomainShortName = 'domain-short-name'
key_name_SchemaMaster = 'schema-master'
key_name_DomainNamingMaster = 'domain-naming-master'
key_name_RIDMaster = 'relative-id-rid-master'
key_name_PDCEmulator = 'pdc-emulator-master'
key_name_InfrastructureMaster = 'infrastructure-master'
key_name_GlobalCatalogServers = 'global-catalog-servers-domain-controllers'
key_name_ADFunctionalLevel = 'ad-level'

}

Below is the name keys

forest-name
domain-full-name
domain-short-name
ad-level
schema-master
domain-naming-master
relative-id-rid-master
pdc-emulator-master
infrastructure-master
global-catalog-servers-domain-controllers

@smjb90
Copy link
Author

smjb90 commented May 1, 2018

@CalebAlbers

@smjb90
Copy link
Author

smjb90 commented May 8, 2018

@CalebAlbers Any more thoughts on this?
Thanks

@mrbiggles0007
Copy link

I know nothing about powershell but I have a feeling it is because it is not getting the functional level of 2016 domains properly, it works on all others.

@zebs1
Copy link

zebs1 commented Dec 2, 2018

Had the same issue, fixed by a small edit to the file "ActiveDirectory.flexasset", line 19 (section AD Level)

From: Options: 2000, 2003, 2008, , 2008 R2, 2012, 2012 R2
To: Options: 2000, 2003, 2008, 2008 R2, 2012, 2012 R2

@S1laRD
Copy link

S1laRD commented May 14, 2019

I'm getting the same on a 2012 R2 and 2016 domains. Have not tested others
`Duplicate keys '' are not allowed in hash literals.
At C:\Users\Admin\ActiveDirectory.ps1:200 char:17

  •             $api__key_name_ADFunctionalLevel = $ADFunctionalLevel
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Collections.Hashtable:Hashtable) [], RuntimeException
    • FullyQualifiedErrorId : DuplicateKeyInHashLiteral`

I used the Initialize-ActiveDirectoryFlexAsset.ps1 script with the latest ActiveDirectory.flexasset file in the same folder to create the Active Directory asset
Any ideas?

EDIT: I tried @zebs1's workaround but made no difference. I'm also getting the same error with the File Shares script

@whiskeyhughes
Copy link

Did you guys figure out a solution for this? I am getting the same exact error.

@coltonmorrisonCHR
Copy link

@CalebAlbers - This issue is still Open almost 4 years later. Why no solution?

@CalebAlbers
Copy link
Collaborator

@coltonmorrisonCHR I'm not an IT Glue employee - I built this in my free time several jobs ago and no longer work in the MSP industry or with Windows/PowerShell.

My guess would be that the call to retrieve AD functional level doesn't work as expected, I'd suggest starting there for debugging.

@coltonmorrisonCHR
Copy link

Sorry, @CalebAlbers, my mistake.

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

7 participants