Avatar of SquigglyMonkey
SquigglyMonkey

asked on 

help with powershell script to get conditions of spooler

I wrote a little script to check the status of print spoolers to verify they are all stopped and set to disabled. 
get-adcomputer -filter 'name -like "*"' | 
    foreach {
        get-service -servicename spooler | select *
    }

Open in new window

The output does not contain the system name, can I get a little help to have that included?
Also. I am only interested in servicename, status, StartType (and system name of course).
Name                : spooler
RequiredServices    : {RPCSS, http}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : False
DisplayName         : Print Spooler
DependentServices   : {}
MachineName         : .
ServiceName         : spooler
ServicesDependedOn  : {RPCSS, http}
ServiceHandle       : SafeServiceHandle
Status              : Stopped
ServiceType         : Win32OwnProcess, InteractiveProcess
StartType           : Disabled
Site                :
Container           :

Open in new window

PowershellScripting LanguagesActive Directory

Avatar of undefined
Last Comment
oBdA
Avatar of SquigglyMonkey
SquigglyMonkey

ASKER

I tried this but still no name.
get-adcomputer -filter 'name -like "*"' | 
    foreach {
        get-service -servicename spooler | select servicename,status,starttype, @{n="ComputerName"; e={$_.DNSHostName}}|ft
    }  

Open in new window

I also tried  
@{n="ComputerName"; e={$_.Name}}|ft

Open in new window

Either way I get no name
ServiceName  Status StartType ComputerName
-----------  ------ --------- ------------
spooler      Stopped Disabled

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Active Directory
Active Directory

Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo