Working with Dos commands in ISE

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of Mark Hammonds Mark Hammonds 7 months, 4 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #34906
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    for the most part dos commands in ISE can be captured in a variable and then parsed. I have an issue with one command the simply opens a command sell runs the command closes the command shell then nothing is in the variable.

    $info = nltest /server:$server /dsgetsite

    however is I run this command in a powershell console it does as expected. Is there some trick im missing here? I love using ISE I don't want to have to use the console if at all possible.

    #34907
    Profile photo of Bob McCoy
    Bob McCoy
    Participant

    Try this ...

    $info = ((nltest /server:dc2 /dsgetsite).getenumerator() -split "`r`n")[0]
    "It is $info"
    
    #34909
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    Nope still just flashes a dos window with no input in the variable

    #34915
    Profile photo of Bob McCoy
    Bob McCoy
    Participant

    I can't vouch for what is going on for your machine. I am running WMF 5.0 and have no issues with the code below. Can you try it on another machine? I've run the script from the console and the ISE without issue.

    $server = "dc2"
    $info = ((nltest /server:$server /dsgetsite).getenumerator() -split "`r`n")[0]
    "It is $info"
    
    #34918
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    maybe its PS3 with the issue I will upgrade and test.

    #34925
    Profile photo of Mark Hammonds
    Mark Hammonds
    Participant

    yup it was powershell I updated to 4.0 and original code works like a charm

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.