DigDeep

Alligning commands with @Comspec

3 posts in this topic

Can someone please help here. Command runs correctly in CMD but doesn't do anything here.

Looks like I am not putting the ' /c ' correctly.

Local $TPM = 'wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get IsEnabled_InitialValue > C:\Temp\TPMStatus.log'
    Run(@ComSpec & ' /c ' & $TPM, "", @SW_HIDE)

 

Share this post


Link to post
Share on other sites



Change the /c to a /k so the window stays open and you can see the error message in the command window


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You must use #RequireAdmin if the UAC is enabled.

Also, you can get the error stream with 2>&1 :

#RequireAdmin
Local $TPM = 'wmic /namespace:\\root\cimv2\security\microsofttpm path win32_tpm get IsEnabled_InitialValue > C:\Temp\TPMStatus.log 2>>&1'
Run(@ComSpec & ' /c ' & $TPM, "", @SW_HIDE)

 

Edited by jguinch

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now