DSQUERY

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

DSQUERY

Post by CyberCitizen » Tue Jun 07, 2016 4:04 am

Hi Guys,

Hoping its something small / simple I have been missing, but be trying for a couple of days trying to workout what is going on.

Image

Code: Select all

GoSub>sDeleteFile

Let>INPUT_BROWSE=0
Input>vComputerName,Please Enter Part Of Asset / Computer Name,

Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

ExtractFileName>Command_Line,strFileName
ExtractFileExt>Command_Line,strExt
StringReplace>%strFileName%,",,strFileName
StringReplace>%strExt%,",,strExt
StringReplace>%strFileName%,%strExt%,,strFileName
Trim>%strFileName%,strFileName
Let>APP_TITLE=%strFileName%

Let>RP_WAIT=1
Let>RP_WINDOWMODE=1
RunProgram>%SYS_NATIVE%\cmd.exe /c dsquery.exe computer -name "*%vComputerName%*" > "%TEMP_DIR%ComputerName.txt"

ReadFile>%TEMP_DIR%ComputerName.txt,vContents
Separate>vContents,%CRLF%,aComputerNames
ArrayCount>aComputerNames,numItems


// ### SUBROUTINES ### //

SRT>sDeleteFile
  IfFileExists>%TEMP_DIR%ComputerName.txt
    DeleteFile>%TEMP_DIR%ComputerName.txt
  EndIf
END>sDeleteFile
FIREFIGHTER

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: DSQUERY

Post by Marcus Tettmar » Tue Jun 07, 2016 2:27 pm

You don't say what the problem is?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: DSQUERY

Post by CyberCitizen » Tue Jun 07, 2016 2:28 pm

Sorry showed the issue in the animated gif.

Basically when I run the command via ms it doesn't work, external it works. Same batch file.

Sent from my SM-T710 using Tapatalk
FIREFIGHTER

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: DSQUERY

Post by Marcus Tettmar » Tue Jun 07, 2016 3:55 pm

Don't see the gif. It's not loading. But usually this is down to quotes, or lack of. You might need e.g.:

%SYS_NATIVE%\cmd.exe /c "dsquery.exe computer -name "*%vComputerName%*" > "%TEMP_DIR%ComputerName.txt""
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: DSQUERY

Post by CyberCitizen » Tue Jun 07, 2016 3:59 pm

Thanks Marcus,

I can't test now for a few days but I am sure it's something simple like that I have been trying all sorts of different formats and quote positions trying to get it right. Hopefully that's the one I need.

Sent from my SM-T710 using Tapatalk
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts