question

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 asked saldana-msft edited

windows powershell version

Hi All

i want to pull all my windows servers with their powershell shell version and OS version in my organization, how do i export this information from sccm, experts guide me on this

mem-cm-generalmem-cm-site-deploymentmem-cm-application
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FionaYan-MSFT avatar image
0 Votes"
FionaYan-MSFT answered FionaYan-MSFT edited

@GlennMaxwell-2309

1.For querying the power shell version, please refer to this helpful guide:
powershell-inventory-reports
Note:This article is non-official articles just for your reference.

2.For querying the OS version,Please refer to this link:
Get-OS-Info-from-SCCM

3.If the OS query was too old for us, maybe we could use sql query to have a try. I have use this query in my environment and it works.
28345-sql-query-os-versions.png
Here is the query code below:
select Distinct
v_R_System.Name0,
v_GS_NETWORK_ADAPTER_CONFIGURATION.IPAddress0,
v_GS_NETWORK_ADAPTER_CONFIGURATION.DNSHostName0,
v_GS_NETWORK_ADAPTER_CONFIGURATION.DNSDomain0,
v_GS_OPERATING_SYSTEM.Caption0 as 'Operating System',
v_GS_OPERATING_SYSTEM.CSDVersion0 as 'Service Pack',
dbo.v_FullCollectionMembership.SiteCode,
CASE
WHEN dbo.v_FullCollectionMembership.SiteCode LIKE 'A%' THEN 'India'
WHEN dbo.v_FullCollectionMembership.SiteCode LIKE 'O%' THEN 'UK'
ELSE 'Unidentified' END AS 'Country'
from v_R_System
INNER JOIN dbo.v_FullCollectionMembership ON dbo.v_R_System.ResourceID = dbo.v_FullCollectionMembership.ResourceID
Inner Join v_GS_OPERATING_SYSTEM ON v_GS_OPERATING_SYSTEM.Resourceid=v_R_System.Resourceid
Inner join v_GS_NETWORK_ADAPTER_CONFIGURATION ON v_GS_NETWORK_ADAPTER_CONFIGURATION.ResourceID=v_R_System.ResourceID
where (dbo.v_FullCollectionMembership.SiteCode != 'NULL') and (Operating_System_Name_and0 != 'NULL')

Hope this could help you.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 answered GlennMaxwell-2309 edited

thanks but not sure how to pull windows powershell version,
the query to be used shud be something like %windir%\System32\WindowsPowerShell\v

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FionaYan-MSFT avatar image
0 Votes"
FionaYan-MSFT answered FionaYan-MSFT commented

@GlennMaxwell-2309

Maybe we could use the SCCM to deploy the power shell script to list some information that we want.
The script was shown as below:
$ostype = (Get-WMIObject win32_operatingsystem).caption
$temp = "{0,-15}{1,-45}{2,-15}" -f "Computername","OS Version","PowerShell Version" | out-file -filepath "shared folder path.txt" -append
if ($ostype -match "server")
{$temp= "{0,-15}{1,-45}{2,-15}" -f $env:COMPUTERNAME,$ostype,$PSVersionTable.PSVersion | out-file -filepath "shared folder path.txt" -append}
29257-os-version.png
Here is a helpful guide to deploy the script:
https://systemcenterdudes.com/sccm-deploy-powershell-script/
Note: This is non-official article just for your reference.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



os-version.png (45.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GlennMaxwell-2309

Just checking in to see if there is any update. We haven't heard from you for a few days and would like to know the current status of the problem. Is the problem solved? Do you need any further assistance? Look forward to hearing from you.

0 Votes 0 ·
dekac avatar image
0 Votes"
dekac answered dekac edited

Use CMPivot and run it against a collection of servers in the question. Something like:

Registry('hklm:\\SOFTWARE\\Microsoft\\Powershell\\3\\PowershellEngine') | where Property == 'RuntimeVersion'

29319-p1.png



p1.png (53.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.