No announcement yet.

Vbs Script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Vbs Script


    I would like to display device IP on Windows legal screen. Does anyone know how to do this?

    I tried but no luck getting the IP to display. Below is thr script I tried changing. The legal text works fine and display IP with a pop works. I'm trying to get the IP to display in the legal captions. Is there a better way to do this. Sysinternals did not work. Thanks

    trComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set IPConfigSet = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
    For Each IPConfig in IPConfigSet
        If Not IsNull(IPConfig.IPAddress) Then 
            For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
               'WScript.Echo "Your computer IP address is: " & IPConfig.IPAddress(i)
        End If
    set wShell = CreateObject("Wscript.Shell") 
    Const POLICY_KEY = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" 
    Const sIPaddr = "& IPConfig.IPAddress(i)" 
    strLegalCaption = sIPaddr 
    Const LEGAL_TEXT_VALUENAME = "legalnoticetext" 
    strLegalText = strLegalText & "The Hamilton Township School district (HTSD) Network incorporates all electronic communication systems and equipment at the Central Board of Education. This Network Acceptable Use Policy (AUP) sets forth the standards by which all Users may use the shared HTSD Network." & vbcrlf & vbcrlf 
    strLegalText = strLegalText & "The HTSD Network is provided to support the district and its mission of education, service, and research. Any other uses, including uses that jeopardize the integrity of the HTSD Network, the privacy or safety of other Users, or that are otherwise illegal are prohibited. The use of the HTSD Network is a revocable privilege." & vbcrlf & vbcrlf 
    strLegalText = strLegalText & "By using or accessing the HTSD Network, Users agree to comply with this AUP and other applicable HTSD policies which may be implemented from time to time, as well as all federal, state, and local laws and regulations. Only Users are authorized to use and/or access the HTSD Network.The term (User) refers to any faculty, staff or student associated with the HTSD, as well as any other individual with access to computers or other network devices that have been approved by the Technology Department for ITS Communication Technologies for connection to the HTSD Network. This definition includes, but is not limited to, contractors, visitors, and temporary affiliates." & vbcrlf & vbcrlf
    strLegalText = strLegalText & "By selecting OK, you are agreeing to the terms of the HTSD Acceptable Use Policy." & vbcrlf & vbcrlf
    ' Copy the line above and repeat for each paragraph in the legal notice. 
    ' Remember it is best to limit your notice to two paragraph that contain no more than 4 
    ' sentences. 
    wShell.RegWrite POLICY_KEY & LEGAL_CAPTION_VALUENAME, strLegalCaption, "REG_SZ" 
    WShell.RegWrite POLICY_KEY & LEGAL_TEXT_VALUENAME, strLegalText, "REG_SZ"