/build/static/layout/Breadcrumb_cap_w.png

Trying to get output of dsregcmd /status

Hi

I want to run a script or custom inventory rule, or something that would be able to get the output of dsregcmd /status on the machines, but when I try to set it as a script, it doesn't seem like it is able to run for some reason, and also as a custom inventory rule, it seems it was not able to get any output either.

Has anyone here ever tried this?  And how were you able to get the output?


0 Comments   [ + ] Show comments

Answers (3)

Posted by: tomciuu 6 months ago
White Belt
0

Hi. Use Powershell and pipe the output to Select-String cmdlet.

Simple example (run within powershell):

dsregcmd /status | Select-String -Pattern "IsUserAzureAd"


If you pack it into foreach statement with list of machines and sprinkle desired output titles in text file after -Pattern, than you might just end up with what you need. Next you could put the output into variables, append each iteration to csv file and generate a nice report in Excel to get the managers attention for a few seconds :)

Posted by: Omishlord 5 months ago
Senior White Belt
0

I am having the same issue and it will not display the information. This is my output from .\KDeploy.exe -custominventory


[2024-06-13.14:55:57][KDeploy:KLaunchClient::DumpState] Launch State:  Command="cmd.exe /c "dsregcmd /status | Select-String -Pattern "IsUserAzureAd""  WorkingDir="" Timeout=3600000 ShouldDetach=0 ShowWindow=0 Redirect_stdout=1 Redirect_stderr=0 Desktop=winsta0\default Using Wait_Override=0

[2024-06-13.14:55:57][KDeploy:KLaunchUtils::DoesTokenH] DoesTokenHaveLSAPriviledges returning: 0

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Launc] KLaunchClientImpl::Launch()    DoesCurrentProcessHaveLSAPriviledges = false

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Launc] KLaunchClientImpl::LaunchNoSession()

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Setup] KLaunchClientImpl::SetupStartInfo    *Don't CreateStdPipe StdIn Pipe (disabled)

[2024-06-13.14:55:57][KDeploy:KLaunchUtils::BuildComma] BuildCommandPath: Did not find cmd.exe /c "dsregcmd /status | Select-String -Pattern "IsUserAzureAd" under searchPath='C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\AdoptOpenJDK\jre-8.0.252.09-hotspot\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\; 

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Launc] KLaunchClientImpl::LaunchNoSession - CreateProcess returned successfully

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::ReadS] KLaunchClientImpl::ReadStdPipe   End of ReadStdPipe method

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Wait ] KLaunchClientImpl::Wait    WaitForSingleObject failed:  status 0, ExitCode 1

[2024-06-13.14:55:57][KDeploy:KLaunchClientImpl::Proce] KLaunchClientImpl::ProcessResults - End

[2024-06-13.14:55:57][KDeploy:CDeployController::Execu] rule [34210] statement result: "", FALSE

[2024-06-13.14:55:57][KDeploy:CDeployController::RunCu] KDeploy    finished processing 7 custominventory rules, sending response

[2024-06-13.14:55:57][KDeploy:CDeployController::RunCu] KDeploy    sending response: [;1233:Q049TFQtNDc0MCx


Has anyone found a way to get this information? 

Posted by: Mbohn@columbiastate.edu 5 months ago
Senior White Belt
0

create a bat within a Script
@echo off
dsregcmd /status>c:\mypath\dsregcmdoutput.txt
exit

create a custom inventory field in INVENTORY > SOFTWARE with the following in the "Custom Inventory Rule:"
ShellCommandTextReturn(cmd /c if exist c:\mypath\dsregcmdoutput.txt type c:\mypath\dsregcmdoutput.txt)

After running the script/bat on a test group, force an inventory on the group.  Check the Custom Inventory details under each machine details.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ