Jump to content

connection cannot be closed


Recommended Posts

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

Link to comment
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. :)

Link to comment
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

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...