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

[Bug]: Exception calling ctor with one argument #92

Open
joostgrunwald opened this issue Feb 22, 2024 · 8 comments
Open

[Bug]: Exception calling ctor with one argument #92

joostgrunwald opened this issue Feb 22, 2024 · 8 comments
Labels
bug Something isn't working status/needs-triage Needs triage

Comments

@joostgrunwald
Copy link

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 joostgrunwald added bug Something isn't working status/needs-triage Needs triage labels Feb 22, 2024
@joostgrunwald
Copy link
Author

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

@silverhack
Copy link
Owner

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!

@mkannan22
Copy link

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."

@silverhack
Copy link
Owner

silverhack commented Mar 9, 2024

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,

@mkannan22
Copy link

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."

@silverhack
Copy link
Owner

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!

@mkannan22
Copy link

mkannan22 commented Mar 9, 2024

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

@silverhack
Copy link
Owner

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status/needs-triage Needs triage
Projects
None yet
Development

No branches or pull requests

3 participants