jaols / ADExportImport

3 stars 1 forks source link

Unable to export OU Structure #1

Closed Arbelac closed 1 year ago

Arbelac commented 1 year ago

Hi,

I want to export my OU Structure via your script. But no luck. I have imported your module.

Import-Module PSJumpStart -Verbose

VERBOSE: Loading module from path 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSJumpStart\PSJumpStart.psd1'. VERBOSE: Importing function 'Add-ScriptHeader'. VERBOSE: Importing function 'ConvertTo-Hashtable'. VERBOSE: Importing function 'Copy-PSTemplate'. VERBOSE: Importing function 'Find-PSTemplate'. VERBOSE: Importing function 'Get-AccessCredential'. VERBOSE: Importing function 'Get-CallerPreference'. VERBOSE: Importing function 'Get-GlobalDefaultsFromDfpFiles'. VERBOSE: Importing function 'Get-GlobalDefaultsFromJsonFiles'. VERBOSE: Importing function 'Get-HtmlAccordion'. VERBOSE: Importing function 'Get-HtmlAlternatingTable'. VERBOSE: Importing function 'Get-ModuleHelp'. VERBOSE: Importing function 'Get-SettingsFiles'. VERBOSE: Importing function 'Invoke-SqlQuery'. VERBOSE: Importing function 'Msg'. VERBOSE: Importing function 'New-RandomPassword'. VERBOSE: Importing function 'Out-DataTableToFile'. VERBOSE: Importing function 'Send-MailMessageUsingHtmlTemplate'. VERBOSE: Importing function 'Update-ScriptHeader'.

then,

.\Export-AdOuStructure.ps1 INFORMATION;5/6/2023 7:55:26 PM;Start Execution Get-ReplaceStrings : The term 'Get-ReplaceStrings' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At Export-AdOuStructure.ps1:116 char:17

Get-StandardExludeAttributes : The term 'Get-StandardExludeAttributes' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that th path is correct and try again. At Export-AdOuStructure.ps1:118 char:27

INFORMATION;5/6/2023 7:55:26 PM;Save data to .OU.2023-05-06.json ConvertTo-GenericStrings : The term 'ConvertTo-GenericStrings' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At Export-AdOuStructure.ps1:166 char:51

INFORMATION;5/6/2023 7:55:26 PM;End Execution

jaols commented 1 year ago

Thank you for reporting an issue!

The ConvertTo-GenericStrings and ConvertFrom-GenericStrings are local functions found in the "localLib" folder that should be in the same folder as the Export-AdOuStructure.ps1.

The command "Import-Module PSJumpStart" will load any functions found in a localLib folder. Hope this will help you.

StachStach commented 1 week ago

I'm having the exact same issue as the originator of this thread and I can't find those missing modules anywhere in the your PSJumpStart installed module (or on my hard drive). How do I get these other required functions loaded as they don't appear to be included with your PSJumpStart project?

Get-ReplaceStrings: E:\Powershell\ADExportImport\Export-AdUsers.ps1:123 Line | 123 | $ReplaceStrings=Get-ReplaceStrings $Replacements | ~~~~~~ | The term 'Get-ReplaceStrings' is not recognized as a name of a cmdlet, function, script file, or executable | program. Check the spelling of the name, or if a path was included, verify that the path is correct and try | again. Get-StandardExludeAttributes: E:\Powershell\ADExportImport\Export-AdUsers.ps1:125 Line | 125 | $ExportExcludeAttributes+=Get-StandardExludeAttributes -Export | ~~~~~~~~ | The term 'Get-StandardExludeAttributes' is not recognized as a name of a cmdlet, function, script file, or | executable program. Check the spelling of the name, or if a path was included, verify that the path is correct | and try again. INFORMATION;10/2/2024 5:57:35 PM;Save data to E:\Powershell\ADExportImport.Users.2024-10-02.json ConvertTo-GenericStrings: E:\Powershell\ADExportImport\Export-AdUsers.ps1:164 Line | 164 | $ObjectList.ToString() | ConvertTo-GenericStrings -ReplaceStrings … | ~~~~~~~~ | The term 'ConvertTo-GenericStrings' is not recognized as a name of a cmdlet, function, script file, or | executable program. Check the spelling of the name, or if a path was included, verify that the path is correct | and try again. INFORMATION;10/2/2024 5:57:35 PM;End Execution

StachStach commented 1 week ago

I finally noticed the locallib folder at the top of the file list in Github, so once I openened the folder and downloaded the ps1 files into my locallib folder, the scripts started working without errors. :)

I hope that this little tip helps someone else along the way.