July 19, 2023 at 6:54 pm
All the user profiles on my test server were deleted. Now, dbatools is not working. Invoke-DbaQuery runs fine in version 5.1. When I run it in 7.2.2, I get the following error message.
Invoke-DbaQuery : The 'Invoke-DbaQuery' command was found in the module 'dbatools', but the module could not be loaded. For more information, run 'Import-Module dbatools'.
When I run Import-Module dbatools, I get the following error message. Any idea how I can resolve this?
Import-Module : Couldn't import dbatools library | Could not load file or assembly 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.At line:1 char:1
+ Import-Module dbatools
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Couldn't import dba.the file specified.:String) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : Couldn't import dbatools library | Could not load file or assembly 'System.Management.Automation, Version=7.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.,Microsoft.PowerShell.Commands.ImportModuleCommand
July 20, 2023 at 7:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
July 21, 2023 at 12:36 am
I think you may have correctly identified the problem... Someone who is more knowledgeable about PoSh than I may have a bit of magic that I don't know about but I'm pretty sure that whoever is running the PoSH code is going to need privs on the server. That might also be done in a "trusted" fashion using an AD group (Active Directory).
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2023 at 12:15 pm
Can you confirm that your DbaTools library is stored in the same location as found when running the following?
$env:PSModulePath -split ';'
(As I think some file locations differ between PoSh and PoSh Core.)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy