# Powershell with SCCM 2012 r2

**URL:** <https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491>\
**Category:** PowerShell Help\
**Created:** [December 7, 2014, 9:27pm UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491 "2014-12-07T21:27:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmdougie](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dmdougie](https://forums.powershell.org/u/dmdougie)\
**Post date:** [December 7, 2014, 9:27pm UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/1 "2014-12-07T21:27:14Z")

</div>

Hi Guys,

Really stupid question, but having a bit of trouble with selecting properties for display as below:

```
get-cmdevice -Name DeviceName | Select Name,Username,LastActiveTime
```

All I get returned is the headers Name, Username, LastActiveTime. What am I missing, I know it’s something simple…

THanks

---

<div class="post-metadata">

**Author:** ![\_timpringle](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/_timpringle/32/276_2.png) [@\_timpringle](https://forums.powershell.org/u/_timpringle)\
**Post date:** [December 7, 2014, 11:11pm UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/2 "2014-12-07T23:11:58Z")

</div>

What output do you get if you just enter :

```
get-cmdevice -Name DeviceName
```

?

---

<div class="post-metadata">

**Author:** ![dmdougie](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dmdougie](https://forums.powershell.org/u/dmdougie)\
**Post date:** [December 7, 2014, 11:39pm UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/3 "2014-12-07T23:39:04Z")

</div>

I get a return of all the attributes of the dvice, including Name, username and LastActiveTime

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [December 8, 2014, 12:26am UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/4 "2014-12-08T00:26:25Z")

</div>

Those are probably not the actual property names, they’re probably just table headers.

```
Get-CmDevice -Name DeviceName | Get-Member
```

To verify the actual property names, which is what you must use with Select-Object.

---

<div class="post-metadata">

**Author:** ![dmdougie](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dmdougie](https://forums.powershell.org/u/dmdougie)\
**Post date:** [December 8, 2014, 12:30am UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/5 "2014-12-08T00:30:42Z")

</div>

Thanks for the reply, Don. I tried that already, but I don’t see an alternative name from the output below. Any ideas?

```
LastActiveTime Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastActiveTime {get;set;}                                                    
LastClientCheckTime Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastClientCheckTime {get;set;}                                               
LastDDR Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastDDR {get;set;}                                                           
LastHardwareScan Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastHardwareScan {get;set;}                                                  
LastInstallationError Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastInstallationError {get;set;}                                             
LastMPServerName Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastMPServerName {get;set;}                                                  
LastPolicyRequest Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastPolicyRequest {get;set;}                                                 
LastSoftwareScan Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastSoftwareScan {get;set;}                                                  
LastStatusMessage Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastStatusMessage {get;set;}                                                 
LastSuccessSyncTimeUTC Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LastSuccessSyncTimeUTC {get;set;}                                            
LatestProcessingAttempt Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject LatestProcessingAttempt {get;set;}                                           
Name Property Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObject Name {get;set;}
```

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [December 8, 2014, 12:37am UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/6 "2014-12-08T00:37:02Z")

</div>

Well, I don’t see UserName there, but assuming that was truncated output. Name and LastActiveTime should work.

If you can pipe the output to Select \*, then you should be able to pipe it to Select with a list of valid property names. If it doesn’t, then sitting here I’ve no idea why that would be the case.

---

<div class="post-metadata">

**Author:** ![dmdougie](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dmdougie](https://forums.powershell.org/u/dmdougie)\
**Post date:** [December 8, 2014, 1:01am UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/7 "2014-12-08T01:01:57Z")

</div>

Sorry should have mentioned that I truncated the output from gm as there are about 50 returned items. This is the output when pipe to select \*

```
get-cmdevice -name DeviceName | select *
ADLastLogonTime : 
ADSiteName : 
AMTFullVersion : 
AMTStatus : 
ClientActiveStatus : 1
ClientCertType : 1
ClientCheckPass : 1
ClientEdition : 0
ClientRemediationSuccess : 1
ClientType : 1
ClientVersion : 5.00.7958.1000
DeviceAccessState : 
DeviceOS : Microsoft Windows NT Workstation 6.3
DeviceOwner : 1
DeviceType : 
Domain : 
EASDeviceID : 
EnrollmentStatus : 
EPAntispywareEnabled : True
EPAntispywareSignatureLastUpdateDateTime : 08/12/2014 02:13:03
EPAntispywareSignatureLastVersion : 1.189.1596.0
EPAntivirusEnabled : True
EPAntivirusSignatureLastUpdateDateTime : 08/12/2014 02:13:03
EPAntivirusSignatureLastVersion : 1.189.1596.0
EPClientVersion : 4.6.305.0
EPDeploymentDescription : 
EPDeploymentErrorCode : 0
EPDeploymentState : 3
EPEnabled : True
EPEngineVersion : 1.1.11202.0
EPInfectionStatus : 2
EPLastFullScanDateTimeEnd : 21/11/2014 18:20:27
EPLastFullScanDateTimeStart : 08/12/2014 10:34:46
EPLastInfectionTime : 
EPLastQuickScanDateTimeEnd : 21/11/2014 11:09:39
EPLastQuickScanDateTimeStart : 08/12/2014 08:49:49
EPLastThreatName : 
EPPendingFullScan : False
EPPendingManualSteps : False
EPPendingOfflineScan : False
EPPendingReboot : False
EPPolicyApplicationDescription : 
EPPolicyApplicationErrorCode : 0
EPPolicyApplicationState : 1
EPProductStatus : 0
ExchangeOrganization : 
ExchangeServer : 
IsActive : True
IsAlwaysInternet : False
IsAOACCapable : False
IsApproved : 1
IsBlocked : False
IsClient : True
IsInternetEnabled : False
IsObsolete : False
IsVirtualMachine : False
LastActiveTime : 08/12/2014 13:12:41
LastClientCheckTime : 22/11/2014 19:59:14
LastDDR : 05/12/2014 15:10:57
LastHardwareScan : 05/12/2014 15:24:30
LastInstallationError : 
LastMPServerName : 
LastPolicyRequest : 08/12/2014 13:12:41
LastSoftwareScan : 
LastStatusMessage : 
LastSuccessSyncTimeUTC : 
LatestProcessingAttempt : 
Name : 
PhoneNumber : 
PolicyApplicationStatus : 
ResourceID : 16777548
ResourceType : 5
RetireStatus : 
SiteCode : CCM
SMSID : GUID:9DD63644-849D-432C-91B1-FB8A89908AB5
Status : 
SuppressAutoProvision : 
Unknown : False
UserDomainName : CAN
UserName : MyUserName
WipeStatus : 
ManagedObject : \\CANSCCM01\root\sms\site_CCM:SMS_CombinedDeviceResources.ResourceID=16777548
EmbeddedProperties : {}
EmbeddedPropertyLists : {}
OverridingObjectClass : SMS_CombinedDeviceResources
RegMultiStringLists : {}
SecurityVerbs : 1342176935
GenericsArray : 
Generics : 
Count : 1
DisplayString : 
DisplayDescription : 
HelpTopic : 
ObjectClass : SMS_CombinedDeviceResources
Properties : [SecurityVerbs(1342176935)]
                                           instance of SMS_CombinedDeviceResources
                                           {
                                               ADSiteName = "";
                                               ClientActiveStatus = 1;
                                               ClientCertType = 1;
                                               ClientCheckPass = 1;
                                               ClientEdition = 0;
                                               ClientRemediationSuccess = 1;
                                               ClientType = 1;
                                               ClientVersion = "5.00.7958.1000";
                                               DeviceOS = "Microsoft Windows NT Workstation 6.3";
                                               DeviceOwner = 1;
                                               Domain = "";
                                               EPAntispywareEnabled = TRUE;
                                               EPAntispywareSignatureLastUpdateDateTime = "20141208021303.000000+***";
                                               EPAntispywareSignatureLastVersion = "1.189.1596.0";
                                               EPAntivirusEnabled = TRUE;
                                               EPAntivirusSignatureLastUpdateDateTime = "20141208021303.000000+***";
                                               EPAntivirusSignatureLastVersion = "1.189.1596.0";
                                               EPClientVersion = "4.6.305.0";
                                               EPDeploymentDescription = "";
                                               EPDeploymentErrorCode = 0;
                                               EPDeploymentState = 3;
                                               EPEnabled = TRUE;
                                               EPEngineVersion = "1.1.11202.0";
                                               EPInfectionStatus = 2;
                                               EPLastFullScanDateTimeEnd = "20141121182027.803000+***";
                                               EPLastFullScanDateTimeStart = "20141208103446.917000+***";
                                               EPLastQuickScanDateTimeEnd = "20141121110939.470000+***";
                                               EPLastQuickScanDateTimeStart = "20141208084949.460000+***";
                                               EPPendingFullScan = FALSE;
                                               EPPendingManualSteps = FALSE;
                                               EPPendingOfflineScan = FALSE;
                                               EPPendingReboot = FALSE;
                                               EPPolicyApplicationDescription = "";
                                               EPPolicyApplicationErrorCode = 0;
                                               EPPolicyApplicationState = 1;
                                               EPProductStatus = 0;
                                               IsActive = TRUE;
                                               IsAlwaysInternet = FALSE;
                                               IsAOACCapable = FALSE;
                                               IsApproved = 1;
                                               IsBlocked = FALSE;
                                               IsClient = TRUE;
                                               IsInternetEnabled = FALSE;
                                               IsObsolete = FALSE;
                                               IsVirtualMachine = FALSE;
                                               LastActiveTime = "20141208131241.000000+***";
                                               LastClientCheckTime = "20141122195914.937000+***";
                                               LastDDR = "20141205151057.000000+***";
                                               LastHardwareScan = "20141205152430.000000+***";
                                               LastMPServerName = "";
                                               LastPolicyRequest = "20141208131241.000000+***";
                                               Name = "";
                                               ResourceID = 16777548;
                                               ResourceType = 5;
                                               SiteCode = "CCM";
                                               SMSID = "GUID:9DD63644-849D-432C-91B1-FB8A89908AB5";
                                               Unknown = FALSE;
                                               UserDomainName = "";
                                               UserName = "";
                                           };
                                           
PropertyNames : {ADLastLogonTime, ADSiteName, AMTFullVersion, AMTStatus...}
MethodNames : 
MethodList : {}
PropertyList : {[ADLastLogonTime,], [ADSiteName,], [AMTFullVersion,], [AMTStatus,]...}
UniqueIdentifier : f3bf93d6-a4f2-490b-9155-61c69336ee04
ParentResultObject : 
GlobalDisplayString : 
AutoCommit : False
AutoRefresh : False
UserDataObject : 
ConnectionManager : Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager
TraceProperties : True
NamedValueDictionary : {[ProviderLocation, \\\ROOT\sms:SMS_ProviderLocation.Machine="",SiteCode="CCM"], [ProviderMachineName,], 
                                           [AllProviderLocations, System.Collections.Generic.List`1[System.Management.ManagementObject]], [Connection, \\\root\sms\site_CCM]...}
AsyncOperationData : 
RetainObjectLock : False
```

I removed some of my personal info. Strange one…

This is what I get from the original select

```
PS CCM:\> get-cmdevice -Name MyDevice | Select-object name,username,lastactivetime

name username lastactivetime                                                            
---- -------- --------------                                                            
                                                                                                                                                                                                                                

PS CCM:\>
```

---

<div class="post-metadata">

**Author:** ![dmdougie](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dmdougie](https://forums.powershell.org/u/dmdougie)\
**Post date:** [December 8, 2014, 1:39am UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/8 "2014-12-08T01:39:49Z")

</div>

Argh. It’s case sensitive. When selecting properties, you need to mind your capitalisation!

Kudos to Dexter:

[http://www.dexterposh.com/2014/04/powershell-sccm-2012-r2-get-client-info.html](http://www.dexterposh.com/2014/04/powershell-sccm-2012-r2-get-client-info.html)

Thanks for your input guys

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:46pm UTC](https://forums.powershell.org/t/powershell-with-sccm-2012-r2/3491/9 "2024-05-16T20:46:38Z")

</div>


