monkey365 icon indicating copy to clipboard operation
monkey365 copied to clipboard

[Bug]: Exception calling ctor with one argument

Open joostgrunwald opened this issue 1 year ago • 8 comments

What happened?
Ctor error when trying to run this like I did before.

How to reproduce it
Clone develop branch, run steps like I do.

Expected behavior
It working without throwing errors.

Screenshots or Logs


PS C:\Users\me\Downloads\monk> Import-Module .\monkey365

PS C:\Users\me\Downloads\monk> $param = @{
    Instance = 'Microsoft365';
    Analysis = @("SharePointOnline","Microsoft365","ExchangeOnline","SharePointOnline","PurView","MicrosoftTeams");
    PromptBehavior = 'SelectAccount';
    IncludeEntraID = $true;
    ExportTo = @("CSV","JSON","HTML");
}

PS C:\Users\me\Downloads\monk> $assets = Invoke-Monkey365 @param

[ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" argument(s): "De opgegeven padindeling wordt niet ondersteund."
At C:\Users\me\Downloads\monk\monkey365\core\init\New-O365Object.ps1:240 char:13
+             throw ("[ParameterError] {0}: {1}" -f "Unable to create M ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: ([ParameterError...t ondersteund.":String) [], RuntimeException
    + FullyQualifiedErrorId : [ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" argument(s): "De opgegeven padindeling wordt niet ondersteund."```


**From where are you running Monkey365?**  
Please, complete the following information:
 - Resource: [Docker container, workstation)  
 - OS: [e.g. Windows, Linux, etc. ]
 - PowerShell Version [`$PsVersionTable`]:
 - Monkey365 Version:
 - Others:


**Additional context**
Add any other context about the problem here.

joostgrunwald avatar Feb 22 '24 21:02 joostgrunwald

Fun addition, this only happens when I run monkey in powershell ISE, I just got it working in regular powershell

joostgrunwald avatar Feb 22 '24 21:02 joostgrunwald

Hi @joostgrunwald, thanks for letting me know about that.

Monkey365 is not designed to work on PowerShell ISE, due to it is not longer maintained by MS. Having said that, I cannot reproduce your issue. I've tested the latest dev version of Monkey365 on several instances and I cannot reproduce it, as shown below:

MonkeyScreenshot

Could you please let me know if it happens again? According to the error message it seems that a variable contains an invalid path format, but it is not clear to me.

Thanks!

silverhack avatar Feb 27 '24 11:02 silverhack

Invoke-Monkey365 @param [ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" argument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." At C:\m\core\init\New-O365Object.ps1:240 char:13

  •         throw ("[ParameterError] {0}: {1}" -f "Unable to create M ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: ([ParameterError...48 characters.":String) [], RuntimeException
    • FullyQualifiedErrorId : [ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" a rgument(s): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."

mkannan22 avatar Mar 08 '24 22:03 mkannan22

Hi @mkannan22,

This isn't a monkey365 issue, and the exception is clear enough (The path is too long). You have multiple options to resolve it, such as producing shorten paths or enabling Long File Paths in Windows 10.

Cheers,

silverhack avatar Mar 09 '24 11:03 silverhack

PS C:\m> Invoke-Monkey365 @param [ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" argument(s): "The given path's format is not supported." At C:\m\core\init\New-O365Object.ps1:240 char:13

  •         throw ("[ParameterError] {0}: {1}" -f "Unable to create M ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: ([ParameterError...not supported.":String) [], RuntimeException
    • FullyQualifiedErrorId : [ParameterError] Unable to create Monkey365 object: Exception calling ".ctor" with "1" a rgument(s): "The given path's format is not supported."

mkannan22 avatar Mar 09 '24 17:03 mkannan22

Hey @mkannan22,

Tested it with multiple versions of PowerShell and OS and I can't reproduce it. Could you please provide more info about how to import it, how to execute it, OS version in use, PS version, etc.. that would be great.

Thanks!

silverhack avatar Mar 09 '24 20:03 silverhack

Test on Windows 10 latest build and Windows 11 latest build. PowerShell version: Name Value


PSVersion 5.1.22621.2506

Import-Module Invoke-Monkey365.ps1 Import-Module every PS script found in all folders

$param = @{ Instance = 'Microsoft365'; Analysis = @("SharePointOnline","Microsoft365","ExchangeOnline","PurView","MicrosoftTeams"); PromptBehavior = 'SelectAccount'; IncludeEntraID = $true; ExportTo = @("CSV","JSON","HTML"); }

$assets = Invoke-Monkey365 @param

mkannan22 avatar Mar 09 '24 20:03 mkannan22

Hi @mkannan22,

As far as I can see from your last comment that you're importing monkey365 incorrectly. Please, see docs about how to import a PowerShell module.

https://silverhack.github.io/monkey365/install-instructions/ https://learn.microsoft.com/en-us/powershell/scripting/developer/module/importing-a-powershell-module?view=powershell-7.3

Cheers,

silverhack avatar Mar 10 '24 11:03 silverhack