Suppressing default output while manipulating services in powershell

  • Is there a way to suppress this default output that I get while stopping a service?

    __GENUS : 2

    __CLASS : __PARAMETERS

    __SUPERCLASS :

    __DYNASTY : __PARAMETERS

    __RELPATH :

    __PROPERTY_COUNT : 1

    __DERIVATION : {}

    __SERVER :

    __NAMESPACE :

    __PATH :

    ReturnValue : 0

    __GENUS : 2

    __CLASS : __PARAMETERS

    __SUPERCLASS :

    __DYNASTY : __PARAMETERS

    __RELPATH :

    __PROPERTY_COUNT : 1

    __DERIVATION : {}

    __SERVER :

    __NAMESPACE :

    __PATH :

    ReturnValue : 0

    Here is how the service is stopped:

    $S = Get-WmiObject `

    -ComputerName $Computer `

    -namespace root\Microsoft\SqlServer\ComputerManagement `

    -class SqlService `

    -Filter $filter

    $S.StopService()

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • I haven't tried it for your specific code, but piping to out-null should do the job.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply