Jump to content

Using RunAs with arguments and variables


PowerCat
 Share

Recommended Posts

I'm trying to get this command working properly but to no avail!

Run(@ComSpec & " /c dsquery computer -name " & @ComputerName & " | dsmod computer -desc " & GuiCtrlRead($compdesc) & "")

As for this command, I can get the command to go as far as getting the computer name, but the part where it reads $compdesc still won't run.

The argument passed to dsmod needs to include quotation marks but I'm having a hard time putting enough quotation marks and apostrophes to get it running.

I was able to get enough quotation marks to change the computer description to "GuiCtrlRead($compdesc)" but that's not helpful!

Where am I going wrong?

Thanks!

Link to comment
Share on other sites

Try displaying it in a MsgBox(), you should then be able to see what the error is.

MsgBox(0, "", @ComSpec & " /c dsquery computer -name " & @ComputerName & " | dsmod computer -desc " & GuiCtrlRead($compdesc) & "")
Edited by AdmiralAlkex
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...