Zahid Ahamed
asked on
Why i can't install dbatools
Hi Expert,
Why i can't install Install-Module -Name DBATools
Install-Module : The term 'Install-Module' 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 line:1 char:1
+ Install-Module -Name DBATools -Force
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Please help
Why i can't install Install-Module -Name DBATools
Install-Module : The term 'Install-Module' 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 line:1 char:1
+ Install-Module -Name DBATools -Force
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Please help
Your PowerShell version is probably too old.
Enter $PSVersionTable in the console, and I think you'll find a PSVersion of 4.
Here's the latest Windows version of PowerShell; install it and then try the Install-Module again.
Windows Management Framework 5.1
https://www.microsoft.com/en-us/download/details.aspx?id=54616
Enter $PSVersionTable in the console, and I think you'll find a PSVersion of 4.
Here's the latest Windows version of PowerShell; install it and then try the Install-Module again.
Windows Management Framework 5.1
https://www.microsoft.com/en-us/download/details.aspx?id=54616
Could just run your "Save-Module -Name DBATools ..." without any issues.
Did you run the recommend "Get-PSRepository", and if so, what did it return?
If that server is behind a proxy, use Save-Module with the -Proxy (and -ProxyCredential, if required) arguments.
Did you run the recommend "Get-PSRepository", and if so, what did it return?
If that server is behind a proxy, use Save-Module with the -Proxy (and -ProxyCredential, if required) arguments.
Since April 2020, TLS 1.2 is set as default for the PowerShell Gallery.
https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/
Run this, then reboot and see if it helps:
https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/
Run this, then reboot and see if it helps:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
ASKER
If you're having trouble interacting with the PSGallery because of TLS version support, you can change the .Net Framework (because Windows PowerShell uses .Net) to enable strong crypto to resolve this.
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls
I'm pretty sure the command in the previous post is only effective for the session it's run in. The below registry edits are persistent and can affect other .Net applications (for instance, I used it to cure a problem in ADFS in Server 2012 R2 before).
https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls
I'm pretty sure the command in the previous post is only effective for the session it's run in. The below registry edits are persistent and can affect other .Net applications (for instance, I used it to cure a problem in ADFS in Server 2012 R2 before).
# For 32-bit applications on 32-bit systems and 64-bit applications on x64-based systems:
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -PropertyType DWORD -Value 1 -Force | Out-Null
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name "SystemDefaultTlsVersions" -PropertyType DWORD -Value 1 -Force | Out-Null
# For 32-bit applications on x64-based systems:
New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -PropertyType DWORD -Value 1 -Force | Out-Null
New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -Name "SystemDefaultTlsVersions" -PropertyType DWORD -Value 1 -Force | Out-Null
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks i just did
C:\Program Files\WindowsPowerShell\Modules\dbatools
What will be the next step to install dbatools?
C:\Program Files\WindowsPowerShell\Modules\dbatools
What will be the next step to install dbatools?
That's it. The following command should show you the module if it all went as it should:
Then you can import the module into a PowerShell session using
Get-Module dbatools -ListAvailable
Output should look like this: Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0.107 dbatools {Select-DbaObject, Set-DbatoolsConfig, Start-DbaMigration, Copy-DbaDatabase...}
Then you can import the module into a PowerShell session using
Import-Module dbatools
ASKER
Could you please give me an one example how to execute the below command and from where? I meant do i have to run this command from this location C:\Program Files\WindowsPowerShell\Modules\dbatools ??!!!
Copies all logins from Source Destination. If a SQL Login on Source exists on the Destination, the Login on Destination will be dropped and recreated.
If active connections are found for a login, the copy of that Login will fail as it cannot be dropped.
"Copy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -Force"
Thanks Again!
Copies all logins from Source Destination. If a SQL Login on Source exists on the Destination, the Login on Destination will be dropped and recreated.
If active connections are found for a login, the copy of that Login will fail as it cannot be dropped.
"Copy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -Force"
Thanks Again!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASKER
Thanks for your help!
try open a Powershell console (with Administrator priviledge) and run that command again.
also make sure you got Internet connection on your machine before that execution.