Jump to content
  • GetComputerName

    GetComputerName

    VBScript

     

    This function returns the name of the computer (i.e. the host hame) the current script (i.e. the SwyxWare) is running on.

    Please see the Introduction chapter for some usage instructions.

     

    ''-------------------------------------------------------------------
    '' Name:     GetComputerName
    ''           ===============
    '' 
    '' Returns the name of the machine/computer this script (i.e. the SwyxWare) is running on.
    '' 
    '' return value:
    ''      string      computer name
    ''
    ''--------------------------------------------------------------------
    Function GetComputerName()
        PBXScript.OutputTrace "---------> GetComputerName"
    
        Dim sReturn
        sReturn = ""
    
        On Error Resume Next
    
        Dim ob
        Set ob = CreateObject("WScript.Network")
    
        If err <> 0 Then
            PBXScript.OutputTrace "Error instanziating 'WScript.Network'! (" & err & ")"
            PBXScript.OutputTrace err.description
        Else
            sReturn = ob.ComputerName
            If err <> 0 Then
                PBXScript.OutputTrace "Error getting property 'ComputerName'! (" & err & ")"
                PBXScript.OutputTrace err.description
            End If
        End If
        Set ob = Nothing 
    
        GetComputerName = sReturn
    
        PBXScript.OutputTrace "sReturn = " & sReturn
        PBXScript.OutputTrace "<--------- GetComputerName"
    End Function

     

    This function makes use of the Server Script API function PBXScript.OutputTrace to write trace information into the SwyxServer trace file.

     

    This function was initially posted into this forum topic.

     

     


    Tom Wellige
     Share


     Share




    User Feedback

    Recommended Comments

    There are no comments to display.



    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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
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.