Showing posts with label Count. Show all posts
Showing posts with label Count. Show all posts

Wednesday, 1 March 2017

SCCM Query find All Server count with OS Name

SCCM Query find All Server count with OS Name



  • Recently I was asked to count of servers by OS
  • It was quite Challenging as we need to understand the SCCM Structure very well to do the SQL Queries.
  • Following are the Queries to fin the Server by OS Name and the count of Servers
SELECT VR.operatingSystem0,COUNT(VR.operatingSystem0) FROM v_R_System AS VR
WHERE VR.operatingSystem0 LIKE '%Windows Server%'
GROUP BY VR.operatingSystem0

Sunday, 9 November 2014

Get-Content:How to use Get-content to Count the Number of Lines in the File

How to use Get-content to Count the Number of Lines in the File

Get-Content is a very powerful command and you will use it very often in your script.


  • Lets say You want to see all Counte of file,type


Get-Content C:\temp\t1.txt

Where C:Temp is the folder path where the file is and t1.txt is the filename


  • Now if you want to Count the number of Files in the file then, use


(get-content c:\temp\t1.txt).count

This will give the number of Lines in the File


  • Now say you want to Pjust first 5 lines in the File, then use


(get-content c:\temp\t1.txt -totalcount 5)

This will give you the first 5 lines


Also to see only Line where Particular word is matching use the below command

get-content C:\temp\t1.txt | select-string "get-c"

This will show lines only where "get-c" matches