Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Script Help

Options
  • 27-07-2004 2:48pm
    #1
    Registered Users Posts: 68 ✭✭


    I posted this in the programming forum, I think I may have been wrong to do so.

    I'd like have all the users associated with a particular login script execute a vbs script that will write the following information to a text file on a network share.

    The users login name
    The users actual name
    The PC to which the user is signing on

    This script has to run on the following platforms NT4 PC's with WMI installed/Windows 2000/Windows XP


    I think these reg entries may help but there might also be WMI variables im not aware of.

    Registry keys
    login name:
    HKCU\Microsoft\Windows\CurrentVersion\Explorer\Logon User Name
    actual name:
    HKLM\System\CurrentControlSet\Services\lanmanserver\parameters\srvcomment
    PC name:
    HKLM\System\ControlSet001\Control\ComputerName\ActiveComputerName\ComputerName

    Any ideas?


Comments

  • Registered Users Posts: 719 ✭✭✭Fionn101


    well get the associated login scripts to call a batch file ,

    in this batch file you will call for certain environment variables eg : %username%
    %computername%

    (a complete list of variables is listed here : http://kennethhunt.com/archives/000933.html)

    as for the registry entries , well have a look at the MS site for scripting
    http://www.microsoft.com/scripting


    or here for an example http://www.tek-tips.com/gviewthread.cfm/pid/96/qid/877511

    There ya go , all done (except for the code itself)

    Have fun

    Fionn
    p.s. post back if you do get stuck and can't get past a certain part.


  • Registered Users Posts: 68 ✭✭alancool


    tanx 4 replying Fionn101 but how do I reference the environment variables in a script? My batch file approach was a simple one line:
    echo %username% %computername% %os% >> F:\log

    In addition I've had to return to the registry to get a fourth piece of info "is the screensaver password enabled?"

    I got this far with Technet if the password is enabled create the file pwdenabled else create the file pwddisabled.

    const HKEY_CURRENT_USER = &H80000001
    strComputer = "."
    Set StdOut = WScript.StdOut
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
    strKeyPath = "Control Panel\Desktop"
    strValueName = "ScreenSaverIsSecure"
    oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue
    If strValue = 1 Then
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFileName = "pwdenabled"
    Set objFile = objFSO.CreateTextFile(strFileName)
    objFile.Close
    Else
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFileName = "pwddisabled"
    Set objFile = objFSO.CreateTextFile(strFileName)
    objFile.Close
    End If


    I would like the log file to go something like

    %username% %computername% %os% %screensaver enabled/disabled%

    Any ideas?? :confused:


Advertisement