0

I started to learn PowerShell. When I run

PS SQLSERVER:\sql> dir

I got this error:

WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'DESKTOP-EGEQJFS' failed with the following error:

An exception occurred in SMO while trying to manage a service.
Failed to retrieve data for this request.
Invalid class

Any ideas?

2
  • What does learning PowerShell have to do with SQL Server? Commented Dec 4, 2018 at 7:33
  • I intended to use it for SQL administration purpose. anyway, my problem is solved. Thanks Commented Dec 6, 2018 at 20:50

1 Answer 1

2
  1. It looks like you're using the SQL Server version of PowerShell. This is intended for performing advanced administration tasks with SQL Server and is not intended as a learning environment.
  2. You're getting the "WARNING: Could not obtain SQL Server Service information" error message because the computer you're attempting to run the SQL Server PowerShell on does not have SQL Server installed or your Windows User account does not have permission to access the SQL Server's configuration data using WMI. If you have SSMS (SQL Server Management Studio) or SSDT (SQL Server Development Tools) installed you won't necessarily have SQL Server installed.
  3. If you want to learn how to use PowerShell then use the Windows PowerShell, not the SQL Server PowerShell. You can find the Windows PowerShell under Start Menu > Windows PowerShell > Windows PowerShell. I recommend using the "PowerShell ISE" tool because it provides a GUI with a listing of all loaded Cmdlets.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.