You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PSScriptTools fails to import with exception Error in TypeData "System.IO.FileInfo": The member Size is already present. when imported after NTSSSecuirty module:
This is also true when the import order is reversed, with the exception that then NTFSSecuirty module fails to import
Reason
Both modules define custom alias property Size for the System.IO.FileInfo type
Expectation
PSScriptTools should import successfully regardless of the import order.
Additional Information
There is similar issue opened in the NTFSSecurity repo, however since nothing was done about it for more than a year, I was hoping that @jdhitsolutions will try to fix it on his end (if possible).
PowerShell version
7.4
Platform
Windows 11 Pro or Enterprise
Additional Checks
You are using the latest version of this module.
You have read this repository's README file.
You have read full help and examples for the command you are having problems with.
You are running PowerShell in an elevated session.
You are running in a traditional PowerShell console or Windows Terminal
The text was updated successfully, but these errors were encountered:
This really isn't a bug as much as by design for PowerShell. If two modules both add a type extension, it is up to the user to decide which module they want to use. In this situation, you can't import both modules in the same session. If you get the error, you must run Remove-Module on what is already loaded and then import the other module. Both modules are importing a types.ps1xml file, and there's no place in the module to force an overwrite, which would have unintended consequences even if you could. There's also no mechanism to import the module without the conflicting type extension. That, too, might have unintended consequences.
The bottom line is that this is not a problem a module author can fix, which is probably why you saw no action on the other module.
If you truly need to run both modules in the same session, I suggest forking the modules and creating customized versions that eliminate the conflicts.
Describe the problem
PSScriptTools
fails to import with exceptionError in TypeData "System.IO.FileInfo": The member Size is already present.
when imported afterNTSSSecuirty
module:This is also true when the import order is reversed, with the exception that then
NTFSSecuirty
module fails to importReason
Both modules define custom alias property
Size
for theSystem.IO.FileInfo
typeExpectation
PSScriptTools
should import successfully regardless of the import order.Additional Information
There is similar issue opened in the NTFSSecurity repo, however since nothing was done about it for more than a year, I was hoping that @jdhitsolutions will try to fix it on his end (if possible).
PowerShell version
7.4
Platform
Windows 11 Pro or Enterprise
Additional Checks
The text was updated successfully, but these errors were encountered: