locked
SQL Server 2014 Mangement Pack with Powershell v2 RRS feed

  • Question

  • Hi

    I've noticed that some Powershell scripts (discoveries, monitoring or collection rules) use the "-version 2" parameter in the MSSQL 2014 Management Packs. This parameter forces the script to run in the old Powershell v2 context. If PSv2 is not installed (like on Windows Server 2012 R2), those scripts doesn't work. This prerequisite is also not documented in the MP Guide.

    Example (check the CommandLine tag):
    https://systemcenter.wiki/?GetElement=Microsoft.SQLServer.2014.AlwaysOn.CommandExecuterDataSource&Type=DataSourceModuleType&ManagementPack=Microsoft.SQLServer.2014.AlwaysOn.Discovery&Version=7.0.7.0

    Is this parameter really necessary? 

    Thanks for feedback
    Toby


    • Edited by ResGear Thursday, December 6, 2018 2:48 PM typo
    Thursday, December 6, 2018 2:48 PM

Answers

  • I've got it. SQLPS Module needs PSv2. The Management Pack uses this Module too. That's the reason for "-version 2" parameter.

    https://docs.microsoft.com/en-us/sql/tools/sqlps-utility?view=sql-server-2014

    • Marked as answer by ResGear Friday, December 7, 2018 11:52 AM
    Friday, December 7, 2018 11:52 AM

All replies

  • I does not agree that MSSQL 2014 only work with PSv2.  In my environment, SQL 2014 with OS Windows Server 2012 R2 work fine.
    roger
    Friday, December 7, 2018 2:27 AM
  • What he meant is that SQL 2014 monitoring relies on powershell scripts that force powershell to run in v2 mode, which is not possible if .NET Framework v2 (or 3.5 as it is backward compatible) is not installed/enabled, as explained here : http://www.thatlazyadmin.com/enable-windows-powershell-v2-0/

    That being said, .NET Framework v3.5 is a prerequisite to install MSSQL2014 (as shown here : https://docs.microsoft.com/en-us/sql/sql-server/install/hardware-and-software-requirements-for-installing-sql-server?view=sql-server-2014 ), so that shouldn't be an issue. 


    • Edited by CyrAz Friday, December 7, 2018 10:36 AM
    Friday, December 7, 2018 10:35 AM
  • Hi Roger

    I'm talking about the SCOM Management Packs for SQL Server 2014, not the DB Engine itself.

    I've identified some Powershell scripts in these MPs, which doesn't work without PSv2:

    in Microsoft.SQLServer.2014.Monitoring
    CPUUsagePercentDataSource.ps1
    DBDiskLatencyDataSource.ps1

    in Microsoft.SQLServer.2014.AlwaysOn.Discovery
    GeneralAlwaysOnDiscovery.ps1
    DatabaseReplicaAlwaysOnDiscovery.ps1

    in Microsoft.SQLServer.2014.AlwaysOn.Monitoring
    AvailabilityGroupMonitoring.ps1


    • Edited by ResGear Friday, December 7, 2018 11:28 AM typo
    Friday, December 7, 2018 11:28 AM
  • I've got it. SQLPS Module needs PSv2. The Management Pack uses this Module too. That's the reason for "-version 2" parameter.

    https://docs.microsoft.com/en-us/sql/tools/sqlps-utility?view=sql-server-2014

    • Marked as answer by ResGear Friday, December 7, 2018 11:52 AM
    Friday, December 7, 2018 11:52 AM