Sign in to follow this  
Followers 0
BullGates

connection cannot be closed

5 posts in this topic

I'm having a problem, could it be related to this issue?

I can't close the connection with my domain servers even if I put all the objects I use = 0. Only when I close the script I can close the connections (using netstat 1 they're visible).


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites



I'm having a problem, could it be related to this issue?

I can't close the connection with my domain servers even if I put all the objects I use = 0. Only when I close the script I can close the connections (using netstat 1 they're visible).

difficult to help you, I have no cristal ball.

Without joking a script is really needed to see if it is related. :)

Share this post


Link to post
Share on other sites

difficult to help you, I have no cristal ball.

Without joking a script is really needed to see if it is related. ;)

Sorry about that, you were right about the crystal ball ;)

Here goes the portion of code:

Dim $Offline = True
Dim $AllowUser = False
Global $UserOnline
$OfflineModeKey = "HKEY_LOCAL_MACHINE\SOFTWARE\UsbAccess"

While 1
    If Check_AD_Link($Offline) = False Then
    
    EndIf
    Sleep(180000)
WEnd

Func Check_AD_Link($Offline)
    $objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $objConnection.Provider = "ADsDSOObject"
    $objConnection.Open ("Active Directory Provider") ; Open connection to AD
    $objRootDSE = ObjGet("LDAP://RootDSE")
    If @error = 0 Then
        $strDNSDomain = $objRootDSE.Get ("defaultNamingContext") ;Retrieve the current AD domain name (DN)
        If @error Then
            $Offline = True
        Else
            $Offline = False
        EndIf
    EndIf
    ConsoleWrite("Offline = " & $Offline & @CRLF)
    Return $Offline
    $objConnection.Close
    $objConnection = 0
EndFunc

I could never get this to close the connections! :)


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites

Oops, I need vacations! I'm using return before the close commands! Please forget it, it's just me being lamme :)


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites

Oops, I need vacations! I'm using return before the close commands! Please forget it, it's just me being lamme :)

Well, I couldn't close the connections, I've dropped using COM for this.

[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

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  
Followers 0