Jump to content
Sign in to follow this  
Agent Orange

Run nlb.exe problem

Recommended Posts

Agent Orange

Hey all...

I am missing something here....I am trying to run a simple Run command for MS Network Load Balancing

If the script cannot connect to the IP address and the port (in this case 80) then it should run a command to stop the NLB on that cluster node. The standard windows command prompt is c:\windows\system32\nlb.exe stop <cluster>:<node>....if I run this command on the server it works fine, if I replace the command with a message box it reponds that it cannot connact that ip/port so it should run the command when I replace the message box with the Run command....but nothing happens (ie the node is active active running the script. Here is the syntax on my command line:

Run(@ComSpec & " /c" & 'c:\windows\system32\nlb.exe stop win2k8nlb:win2k8nlb2',"",@SW_HIDE)

Here is the entire code:

$g_IP = "IP HERE"

; Start The TCP Services
;==============================================
TCPStartUp()

; Connect to a Listening "SOCKET"
;==============================================
$socket = TCPConnect($g_IP, 80)

If $socket = 1 Then
    MsgBox(1,"Invalid IP","Invalid IP")
    TCPCloseSocket($socket)
    TCPShutdown()
    Exit
ElseIf $socket = 2 Then
    MsgBox(1,"Invalid Port","Invalid Port")
    TCPCloseSocket($socket)
    TCPShutdown()
    Exit
ElseIf $socket = -1 Then
    ;MsgBox(1,"Invalid connection","Invalid connection")
    Run(@ComSpec & " /c" & 'c:\windows\system32\nlb.exe stop win2k8nlb:win2k8nlb2',"",@SW_HIDE)
    TCPCloseSocket($socket)
    TCPShutdown()

EndIf
Exit

Share this post


Link to post
Share on other sites
Danny35d

Here is the syntax on my command line:

You need a space between " /c " & 'c:\windows\...'

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites
Agent Orange

You need a space between " /c " & 'c:\windows\...'

Thanks Danny35d.....tried that just now and it did not fix the issue. There is no error....just doesn't work.

Thanks,

Share this post


Link to post
Share on other sites
Danny35d

Two think that I will do:

1) Add the working directory instead of "". Changed to "c:\windows\system32" or @TempDir

2) Change SW_HIDE for SW_SHOW if there is an error then you can see it.


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites
GEOSoft

For sure you are missing a space after the /c

@ComSpec & " /c "

Also you should shorten the path whenever possible

@SystemDir & "\nlb.exe stop win2k8nlb:win2k8nlb2"

Since @SystemDir is in the Windows environment path it can even be shortened to

"nlb.exe stop win2k8nlb:win2k8nlb2"

So now you have

Run(@Comspec & " /c " & @SystemDir & "\nlb.exe stop win2k8nlb:win2k8nlb2", "", @SW_HIDE)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.