Querying SCCM only works sometimes Powershell The Next CEO of Stack OverflowHow does database indexing work?How to return only the Date from a SQL Server DateTime datatypeInserting multiple rows in a single SQL query?Determine installed PowerShell versionget-wmiobject sql join in powershell - trying to find physical memory vs. virtual memory of remote systemsPowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?PowerShell Convert output to hashtable array (data type conversion)Get Username from computer name using powershell and sccmSCCM and Client 'Replace'
Free fall ellipse or parabola?
How seriously should I take size and weight limits of hand luggage?
What happens if you break a law in another country outside of that country?
Is a linearly independent set whose span is dense a Schauder basis?
How can I prove that a state of equilibrium is unstable?
Planeswalker Ability and Death Timing
Is this a new Fibonacci Identity?
Can you teleport closer to a creature you are Frightened of?
How to compactly explain secondary and tertiary characters without resorting to stereotypes?
How to show a landlord what we have in savings?
Which acid/base does a strong base/acid react when added to a buffer solution?
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Is it possible to create a QR code using text?
Calculating discount not working
Masking layers by a vector polygon layer in QGIS
A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?
Why did early computer designers eschew integers?
Why did the Drakh emissary look so blurred in S04:E11 "Lines of Communication"?
pgfplots: How to draw a tangent graph below two others?
Find a path from s to t using as few red nodes as possible
That's an odd coin - I wonder why
Arrows in tikz Markov chain diagram overlap
Find the majority element, which appears more than half the time
Querying SCCM only works sometimes Powershell
The Next CEO of Stack OverflowHow does database indexing work?How to return only the Date from a SQL Server DateTime datatypeInserting multiple rows in a single SQL query?Determine installed PowerShell versionget-wmiobject sql join in powershell - trying to find physical memory vs. virtual memory of remote systemsPowerShell says “execution of scripts is disabled on this system.”How do you comment out code in PowerShell?PowerShell Convert output to hashtable array (data type conversion)Get Username from computer name using powershell and sccmSCCM and Client 'Replace'
I wish to query the SCCM SQL server but it only works when the command is a certain way. For instance, this works
Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system"
But this will not work
(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system").Name
When I run the first command, the output looks like this for every system
__GENUS : 2
__CLASS : SMS_R_System
__SUPERCLASS : SMS_Resource
__DYNASTY : SMS_BaseClass
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : SMS_Resource, SMS_BaseClass
__SERVER : serverName
__NAMESPACE : rootsmssite_P01
__PATH :
Name : computerName
PSComputerName : serverName
I tried surrounding the command with parenthesis in the non-working example and doing .Name
to retrieve the "Name" attribute but that didn't work. There was no error but the script just kept running with no output.
Why is this the case? I'm able to run a command like this without a problem:
$Computers =(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system where LastLogonUserName='$User'").Name
sql powershell sccm
|
show 13 more comments
I wish to query the SCCM SQL server but it only works when the command is a certain way. For instance, this works
Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system"
But this will not work
(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system").Name
When I run the first command, the output looks like this for every system
__GENUS : 2
__CLASS : SMS_R_System
__SUPERCLASS : SMS_Resource
__DYNASTY : SMS_BaseClass
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : SMS_Resource, SMS_BaseClass
__SERVER : serverName
__NAMESPACE : rootsmssite_P01
__PATH :
Name : computerName
PSComputerName : serverName
I tried surrounding the command with parenthesis in the non-working example and doing .Name
to retrieve the "Name" attribute but that didn't work. There was no error but the script just kept running with no output.
Why is this the case? I'm able to run a command like this without a problem:
$Computers =(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system where LastLogonUserName='$User'").Name
sql powershell sccm
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
Instead of forming your own query, have you considered using the cmdlet's parameters?Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
Are you able to access the name on it then?$output['Name']
– TheIncorrigible1
Mar 8 at 19:47
|
show 13 more comments
I wish to query the SCCM SQL server but it only works when the command is a certain way. For instance, this works
Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system"
But this will not work
(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system").Name
When I run the first command, the output looks like this for every system
__GENUS : 2
__CLASS : SMS_R_System
__SUPERCLASS : SMS_Resource
__DYNASTY : SMS_BaseClass
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : SMS_Resource, SMS_BaseClass
__SERVER : serverName
__NAMESPACE : rootsmssite_P01
__PATH :
Name : computerName
PSComputerName : serverName
I tried surrounding the command with parenthesis in the non-working example and doing .Name
to retrieve the "Name" attribute but that didn't work. There was no error but the script just kept running with no output.
Why is this the case? I'm able to run a command like this without a problem:
$Computers =(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system where LastLogonUserName='$User'").Name
sql powershell sccm
I wish to query the SCCM SQL server but it only works when the command is a certain way. For instance, this works
Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system"
But this will not work
(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system").Name
When I run the first command, the output looks like this for every system
__GENUS : 2
__CLASS : SMS_R_System
__SUPERCLASS : SMS_Resource
__DYNASTY : SMS_BaseClass
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : SMS_Resource, SMS_BaseClass
__SERVER : serverName
__NAMESPACE : rootsmssite_P01
__PATH :
Name : computerName
PSComputerName : serverName
I tried surrounding the command with parenthesis in the non-working example and doing .Name
to retrieve the "Name" attribute but that didn't work. There was no error but the script just kept running with no output.
Why is this the case? I'm able to run a command like this without a problem:
$Computers =(Get-WmiObject -namespace $SCCMNameSpace -computer $SCCMServer -query "select Name from sms_r_system where LastLogonUserName='$User'").Name
sql powershell sccm
sql powershell sccm
asked Mar 8 at 19:27
Colebacha2Colebacha2
34
34
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
Instead of forming your own query, have you considered using the cmdlet's parameters?Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
Are you able to access the name on it then?$output['Name']
– TheIncorrigible1
Mar 8 at 19:47
|
show 13 more comments
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
Instead of forming your own query, have you considered using the cmdlet's parameters?Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
Are you able to access the name on it then?$output['Name']
– TheIncorrigible1
Mar 8 at 19:47
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
Instead of forming your own query, have you considered using the cmdlet's parameters?
Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
Instead of forming your own query, have you considered using the cmdlet's parameters?
Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
Are you able to access the name on it then?
$output['Name']
– TheIncorrigible1
Mar 8 at 19:47
Are you able to access the name on it then?
$output['Name']
– TheIncorrigible1
Mar 8 at 19:47
|
show 13 more comments
0
active
oldest
votes
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069765%2fquerying-sccm-only-works-sometimes-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069765%2fquerying-sccm-only-works-sometimes-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What version of PowerShell?
– TheIncorrigible1
Mar 8 at 19:31
@TheIncorrigible1 5.1
– Colebacha2
Mar 8 at 19:33
Instead of forming your own query, have you considered using the cmdlet's parameters?
Get-WmiObject -Namespace $SCCMNameSpace -ComputerName $SCCMServer -Class SMS_R_SYSTEM -Property Name
– TheIncorrigible1
Mar 8 at 19:41
@TheIncorrigible1 I had not considered that; however, that is yielding the exact same output instead of just the name.
– Colebacha2
Mar 8 at 19:45
Are you able to access the name on it then?
$output['Name']
– TheIncorrigible1
Mar 8 at 19:47