Script to query / monitor logins to Servers

Not sure if I'm in the right forum, apologies if I'm not. Not sure where this should go ... anyway, is it possible to query username logins to Windows Server 2008?
Information needed:
1) Username
2) date / time login
3) date / time logoff
Preferably, a way to query multiple servers at one go into an Excel file or something. And not using some freeware or additional installs.
Thanks

You'll need to turn on some auditing. This one may help.
http://support.microsoft.com/en-us/kb/556015
As far as scripting something here may work.
https://gallery.technet.microsoft.com/scriptcenter
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

Similar Messages

  • App-V PowerShell: Script to Query XenApp Servers for App-V Publishing Errors and Output an Excel Document with the Results

    Please Vote if you find this to be helpful!
    App-V PowerShell:  Script to Query XenApp Servers for App-V Publishing Errors and Output an Excel Document with the Results
    Just posted this to the wiki:
    http://social.technet.microsoft.com/wiki/contents/articles/25323.app-v-powershell-script-to-query-xenapp-servers-for-app-v-publishing-errors-and-output-an-excel-document-with-the-results.aspx

    Hi petro_jemes,
    Just a little claritification, you need to add the value to the variable "[string]$ou", and also change the language in the variable "$emailbody" in the function "Get-ADUserPasswordExpirationDate".
    I hope this helps.

  • Testing an ISA Server Rule, the recursive query to other DNS Servers test fails

    Hello,
    I am trying to configure the following infrastructure with ISA Server 2006 and two W2003 servers (called "Server1" and "Server2") . "Server1" is a domain controller, and in
    "Server2" is the ISA Server installed, which also has
    attached two network Ethernet cards, one called "Internal Ethernet Card", and the other one called
    "External Ethernet Card".
    The infrastructure would be:  "Internal Ethernet Card"---- ISA Server ----"External Ethernet Card"---"Router"----"Internet"
    "Internal Ethernet Card" manages the internal package traffic of the infrastructure, the network segment which belongs is isolated from what we could called the Outbound traffic, which is linked to a router. "Internal Ethernet Card" it`s
    a virtual network.
    "Internal Ethernet Card" feature configuration is the following:
    - IP address: 192.168.3.3
    - Subnet Mask: 255.255.255.0
    - DHCP Enabled: No
    - DNS Server: 192.168.3.1 (Must point to the DC "Server1" which has the DNS Service installed)
    - Default Gateway:  None  (because doesnt point to outside)
    - Primary WINS Server: 192.168.3.1  
    The "External Ethernet Card" provides, the outbound connection, and this card is connected to the physical router.
    It`s feature configuration is the following:
    - IP address: 192.168.1.50
    - Subnet Mask: 255.255.255.0
    - DHCP Enabled: No
    - Default Gateway: 192.168.1.1
    - DNS Servers: 192.168.3.1 (Must point to the DC "Server1" which has the DNS Service installed)
    After configuring the network cards, I create the following rule in the ISA Server to allow the traffic towards outside from the server and the clients which have joined to the domain:
    Action: Allow.  Protocol: DNS.  From:"Server2".  To : External.  Condition: All Users
    After applying the changes to update the configuration, I enter in the Dns Server of "Server1" and in the "Monitoring" tab, I run a "recursive query to other DNS Servers" but fails.
    Only works the "simple query against this DNS Server".
    I don`t know why fails, but I`m stucked on this issue, because in the "Server1" DNS Server, in the "domain forward IP address list", I have added two DNS addresses which work OK.
    I would appreciate some help to solve this issue.
    Thanks
    Regards 

    Hello Ms. Long, 
    Yes, you are right. In the Server1 is configured the DNS server, to use forwarders whose are set in the field "Selected domain`s forwarder IP address list", two DNS address numbers obtained from "Open DNS", which work well.
    There is no DNS Server linked to the External NIC.
    The Server1 belongs to a private network configured as "VMnet3", which it is set as follows:
    IP address: 192.168.3.1
    Subnet Mask: 255.255.255.0
    Default Gateway: 192.168.3.3
    DNS Server: 192.168.3.1
    I have tried to test your suggested idea:
    > set d2
    > google.com
    Server:  srv-dcfs-01.dominio.local
    Address:  192.168.3.1
    SendRequest(), len 42
        HEADER:
            opcode = QUERY, id = 2, rcode = NOERROR
            header flags:  query, want recursion
            questions = 1,  answers = 0,  authority records = 0,  additional = 0
        QUESTIONS:
            google.com.dominio.local, type = A, class = IN
    Got answer (113 bytes):
        HEADER:
            opcode = QUERY, id = 2, rcode = NXDOMAIN
            header flags:  response, auth. answer, want recursion, recursion avail.
            questions = 1,  answers = 0,  authority records = 1,  additional = 0
        QUESTIONS:
            google.com.dominio.local, type = A, class = IN
        AUTHORITY RECORDS:
        ->  dominio.local
            type = SOA, class = IN, dlen = 46
            ttl = 3600 (1 hour)
            primary name server = srv-dcfs-01.dominio.local
            responsible mail addr = hostmaster
            serial  = 41
            refresh = 900 (15 mins)
            retry   = 600 (10 mins)
            expire  = 86400 (1 day)
            default TTL = 3600 (1 hour)
    SendRequest(), len 28
        HEADER:
            opcode = QUERY, id = 3, rcode = NOERROR
            header flags:  query, want recursion
            questions = 1,  answers = 0,  authority records = 0,  additional = 0
        QUESTIONS:
            google.com, type = A, class = IN
    DNS request timed out.
        timeout was 2 seconds.
    timeout (2 secs)
    SendRequest failed
    *** Request to srv-dcfs-01.dominio.local timed-out
    As you can see highlighted in bold, the problem remains in the "recursive query to other DNS Servers" check.
    Maybe is better to put the issue on the "Windows Server General Forum" , because the issue has not nothing in common with the ISA Server, dont you?
    Thanks
    Best regards

  • Automated load monitoring of WLE servers

    This is about WLE 5.x.
    The psr command (at the tmadmin prompt) comes in handy for monitoring loads on
    servers in a WLE domain. However its drawback is it's interactive. This command
    can't be wrapped in a script (to my knowledge) and scheduled to run periodically
    to compute load stats. Does anybody know how to do this?
    Per the WLE documentation, pretty much everything that can be done from command
    line can also be done using a Tuxedo API from a program. Has anybody tried writing
    such programs (e.g. a better admin gui) to gather the load stats of servers in
    a domain? The documentation says precious little on this topic.
    Thanks,
    -Abhijeet

    Hi,
    I think I have a solution for you, for UNIXs, anyway. In a Korn shell window, or
    possibly a cron job, if you do the following:
    prompt> echo psr | tmadmin >> psr.out
    the "tmadmin" command will run with the "psr" command and then exit, leaving the
    output in a file called "psr.out". Although I haven't scripted this, I have used it
    and the "printqueue" command to monitor a running WLE system. A co-worker wrote a C++
    program to sum the coloums of the output files, giving reasonable statistics over
    time. If you script this in Perl or Ksh, please post for us!
    -- Steve
    Abhijeet Deshpande wrote:
    This is about WLE 5.x.
    The psr command (at the tmadmin prompt) comes in handy for monitoring loads on
    servers in a WLE domain. However its drawback is it's interactive. This command
    can't be wrapped in a script (to my knowledge) and scheduled to run periodically
    to compute load stats. Does anybody know how to do this?
    Per the WLE documentation, pretty much everything that can be done from command
    line can also be done using a Tuxedo API from a program. Has anybody tried writing
    such programs (e.g. a better admin gui) to gather the load stats of servers in
    a domain? The documentation says precious little on this topic.
    Thanks,
    -Abhijeet[att1.html]

  • How to change the Default login script and the USER login script in Netware3.12

    I need to cut down the disk map from Neware 3.12 in Win98 client's PC.
    please tell me
    how to change the Default login script and the USER login script in
    Netware3.12 ?
    Or is there any other ways to do this thing?
    Thanks a lot!

    On 4/6/2006 [email protected] wrote:
    > how to change the Default login script and the USER login script in
    > Netware3.12 ?
    Please repost in the discontinued.forums.
    Edison Ortiz
    Novell Product Support Forum SysOp
    (No Email Support, Thanks !)

  • Looking for a Powershell Script which can put the scom servers in maintenance mode

    Looking for a Powershell Script which can put the scom servers in maintenance mode so that SCOM should not send an alert during planned task.
    Rahul

    1. Provide list of servers line-by-line in C:\ServerList.txt, make sure you provide limited no. of servers, do not exceed 20 - 25 per batch
    2. Save the script with suitable name (test.ps1)
    3. Open PowerShell cmd prompt
    4. Script accepts 3 params - TimeInMinutes, Reason and Comment
    **** Please note, this script will work for SCOM 2012 R2
    param([int32]$TimeMin, [string]$Reason, [string]$Comment)
    try
    $api = new-object -comObject 'MOM.ScriptAPI'
    Import-Module operationsmanager
    New-SCOMManagementGroupConnection
    $Servers = Get-Content "C:\ServerList.txt"
    $Time = (Get-Date).Addminutes($TimeMin)
    Foreach ($Server in $Servers)
    #Get Computer instance
    $ComputerClass = Get-SCOMClass -Name Microsoft.Windows.Computer
    $ComputerClassInstance = Get-SCOMClassInstance  -Class $ComputerClass | Where {$_.DisplayName -eq $Server}
    If ($ComputerClassInstance -ne $Null)
    $HealthServiceWatcherClass = Get-SCOMClass -name:Microsoft.SystemCenter.HealthServiceWatcher
    #Get Health Service Watcher Class instance of the server
    $HSWClass = Get-SCOMClass -Name Microsoft.SystemCenter.HealthServiceWatcher
    $HSWClassIns = Get-SCOMClassInstance  -Class $HSWClass | Where {$_.DisplayName -eq $Server}
    #Starting the maintenance mode
    Start-SCOMMaintenanceMode -Instance $HSWClassIns -EndTime $Time -Reason $Reason -Comment $Comment
    Start-SCOMMaintenanceMode -Instance $ComputerClassInstance -EndTime $Time  -Reason $Reason -Comment $Comment
    Write-Host "Health Service Watcher and Agent server "$Server " kept in maintenance mode"  -foregroundcolor "green"
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 200, 0, "$Server kept in maintenance mode for $TimeMin minutes")
    Else
    Write-Host $Server" not found " -foregroundcolor "red"
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 201, 1, "$Server could not be found in domain")
    Catch [system.exception]
    $api.LogScriptEvent('MaintenanceModeScript.ps1', 201, 1, $_.Exception.Message)
    Faizan

  • Error while Opening any Query from Query Monitor and Query Designer.

    Hill All,
    I was trying activate activate the Web templates for SRM, all the templates are activated and i am landed in a new problem. when ever i am trying to open a qery thru query Monitor(RSRT), i am popped with the Short dump.
    Short Dump Description:
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_RS_PERS_PHK================CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
        The following syntax error occurred in program "GP48WGGNR675NB9JBTAGV72K4CT "
         in include "GP48WGGNR675NB9JBTAGV72K4CT " in
        line 29:
        "The type "/BI0/APERS_BOD00" is unknown."
        The include has been created and last changed by:
        Created by: "CBI_BALAJID "
        Last changed by: "CBI_BALAJID "
    and when i try to debug the program "GP48WGGNR675NB9JBTAGV72K4CT"
    the error is shown at the code level:
    form pers_read
      tables   e_t_data  structure RSPER_S_RETSTRU_BOD
      using    i_maxrows type i
               i_t_sel   type rsper_t_select
      changing e_subrc   type sy-subrc.
      data: l_t_data type /BI0/APERS_BOD00 occurs 0.
      data: l_s_ft like /BI0/APERS_BOD00.
      data: l_s_sel type rsper_s_select.
      field-symbols: <l_s_data> type /BI0/APERS_BOD00.
    i am unable to find the info object APERS_BOD00. where as the error is pointing to sid table of the object.
    that's urgent,Some one Plese resolve the issue.Points will be rewarded for the usefull answers.
    Thanks in advance
    Balaji Donepudi.
    098266-89888

    Hi,
    Check for the consistency of the info object in RSRV.
    Check the info object status in cube like any data is available or not for that info object.
    Also check any parralel load is taking place in that particular cube.
    Please let me know if u face probelm
    Thanks
    Kind Regards,
    Shanbagavalli.S

  • Script to open Remote Login in "sharing" not working after move to 10.5

    Under 10.4 I sued the following script to open Remote Login (tick the box). Under 10.5.6 it does not work.
    do shell script "/usr/bin/open /System/Library/PreferencePanes/SharingPref.prefPane"
    activate application "System Preferences"
    tell application "System Events"
    tell process "System Preferences"
    click checkbox 1 of row 6 of table 1 of scroll area 1 of tab group 1 of window "Sharing"
    delay 3
    tell application "System Events"
    quit application "System Preferences"
    end tell
    end tell
    end tell
    I get the following error:
    System Events got an error: Can’t get tab group 1 of window "Sharing" of process "System Preferences". Invalid index.
    Anybody know why?

    give this a spin
    activate application "System Preferences"
    tell application "System Events"
    tell process "System Preferences"
    click button "Sharing" of scroll area 1 of window "System Preferences"
    select scroll area 1 of group 1 of window "Sharing"
    select static text "File Sharing" of row 3 of table 1 of scroll area 1 of group 1 of window "Sharing"
    select checkbox 1 of row 3 of table 1 of scroll area 1 of group 1 of window "Sharing"
    click button "Options…" of splitter group 1 of group 1 of window "Sharing"
    click checkbox "Share files and folders using FTP" of sheet 1 of window "Sharing"
    delay 0.5
    select button 2 of sheet 1 of window "Sharing"
    keystroke return
    delay 0.5
    tell application "System Events"
    quit application "System Preferences"
    end tell
    end tell
    end tell
    -----------------

  • Script to Query Printers for serial numbers

    I am trying to create a script to query HP MFP printers to retrieve the serial number of the printer.
    We have hundreds of printers in our environment and at least 10 different models of HP printers.
    I am tasked with making sure all networked printers serial number is the host name of the printer.
    I cannot figure out how to retrieve the serial number from the printer via a vb script. 
    Any help in this area would be greatly appreciated.

    I am referring to the script below, how can I get the result to output in an XLS or CSV format, I tried couple of combinations but couldn't get it to work.# This script shows the last time that a successfull Windows Update was installed.clsadd-PSSnapin quest.activeroles.admanagement 
    $OnlineServers = @() 
    Get-QADComputer -SearchRoot 'domain.com/ServerOU'-OSName "Windows*Server*"| %{ 
      $PingResult = Get-WmiObject-Query "SELECT * FROM win32_PingStatus WHERE address='$($_.Name)'"If ($PingResult.StatusCode -eq 0)  
         # Add the current name to the array$OnlineServers+= "$($_.Name)" 
    foreach ($Serverin$OnlineServers ) 
            $key = “SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install” 
            $keytype = [Microsoft.Win32.RegistryHive]::LocalMachine 
            $RemoteBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype,$Server) 
            $regKey = $RemoteBase.OpenSubKey($key) 
            $KeyValue = $regkey.GetValue(”LastSuccessTime”) 
            $System = (Get-Date-Format "yyyy-MM-dd hh:mm:ss")  
            if    ($KeyValue-lt $System) 
                Write-Host " " 
                Write-Host $Server"Last time updates were installed was: "$KeyValue
        }

  • Query monitor

    Hi,
    I am new to sap bi. I know we can check the performance of the query through query monitor through rsrt. But by looking at which field we will come to know that query performance is slow in the query monitor
    Thanks in advance
    krish

    Hi,
    Goto RSRT transaction --> Give query name --> Query Disply as "HTML" > Execte + Debug> --> Continue. Qury will be executed.
    Follow below steps to find out the query execution time:
    Now goto SE11 > Give table name as RSDDSTAT_DM or RSDDSTAT_OLAP in BI7.0 or RSDDSTAT in BW3.x.> Display -> Contents-> Give from date and to date values as today, user name as your user ID, and give the query name in the Object name field--> execute.
    Now u'll get a list with fields like Object anme(Report anme), Time read, Infoprovider name(Multiprovider), Partprovider name (Cube), Aggregate name... etc.
    The time read represents the time taken to execute the query.
    If the time read is less than 100,000,000 (100 sec) is acceptable. If the time read is more than 100 sec then we take decision to create Aggregates for that query to increase performance.
    Hope it helps you...
    With Regards
    kulwinder

  • Query cache,query monitor

    Hi
    wt is the purpose of Query monitor and query cache.. can u plz.. explain
    ponts assured*
    Regards
    Rekha

    As the verbeage indicates, query monitor is to monitor the runtime performance of BW queries. Query monitor is one of the tools in BW to monitor the query performance. The transaction to run query monitor is RSRT.
    In RSRT, you can exceute queries in various modes and you can to some extent enforece a query to be executed in a certain path; For example, you can simulate the execution of  q query without using a aggregate, without using cache, etc.
    In monitor you can also view how the query is getting executed and diagnose the possible causes as to why a query is running slow.
    Caching is to store the query results in the memory of the BW  system's application server.  If you cache a query, the run time performance  will improve considerably, because the result ste is stored in the meonry and every time when the query is run, the OLAP engine will not have to read the data base to fetch the records.
    The query caching has some limitations; if the query result changes, the cache will not help, because the new result set has to be again read from database and presented.
    You can get more on this in help.sap.com
    Ravi Thothadri

  • Script to query multiple Oracle servers & instances

    Hi
    If I have a list of either database servers, or database instances, is there any way I can create and run a single script-query that would give me a list of all users in all databases? Are there any tools that would do this? Perhaps an OEM based enhancement?
    Ideally I'd like to just point the script-query at a tnsnames file, with the appropriate username/password and let it run from there. We have Oracle v10.2 environment in AIX and Linux & windows.The database are not Oracle GRID managed.
    I'm thinking on the line of shell script or powershell.
    Thanks

    user4807091 wrote:
    Hi,
    If i have 80 oracle databases it means i have to create 80 db link and then need to call the stored procedure to extract db information.
    ThanksAnd whenever you add a database to your environment you have to add another link. Some people have a complete aversion to doing anything in a script if it can be done in a database procedure. I say "horses for courses". Use the tool that works best for the application at hand. I actually have skeleton script for whenever I need to report something from all of my databases. For your issue it would be something like this:
    -- doit.sql
    select username from dba_users;
    exitand (an os script .. shell for *nix, .cmd for Windblows)
    sqlplus system/manager@db1 @doit >> report.list
    sqlplus system/manager@db2 @doit >> report.list
    sqlplus system/manager@db3 @doit >> report.listMind you, this is for a quick and dirty for ad hoc reports. Maintenance for adding/dropping databases is simply a matter of adding/deleting a line from the shell/cmd script.

  • Running a Select query against multiple sql servers using SSIS script task.

    Hi Guys,
    I need to fetch data from multiple sql servers using  SSIS scirpt task inside a foreach container.
    is there anyway i can build dynamic sql connections using ssis variables inside SSIS script task in each loop
    Please guide me or refer any blogs so that i will try..
    Thanks in advance.

    Your only options is using .net code, then it will be no different than using a console app in a loop.
    using (SqlConnection connection = new SqlConnection(connectionString))
    connection.Open();
    Console.WriteLine("ServerVersion: {0}", connection.ServerVersion);
    Console.WriteLine("State: {0}", connection.State);
    and so forth for each connection string
    the connection string would come from the ForEach loop
    Arthur My Blog

  • Script for adding a login item for all accounts in the system

    Hi,
    Thanks for reading this query. I am new to the mac environment. I have developed a java application and created an installer of this application for MAC system.I want to run this application on starting the system. So I have written an apple script for adding this application in login items and this script will run immediately after completing installation process. And the entire process is fine. But the problem is, the application is added to login items of only the user who installed the application. But I want to get available the application in the login list of all accounts created in the system. How can I achieve this? Once more thanks in advance. I am attaching my script below:
    +*tell application "System Events"*+
    +* make login item at end with properties {path:"/Applications/MyApplication.app", hidden:true}*+
    +*end tell*+

    Hi,
    Try to use tables RSOSFIELDMAP, RSDSSEGFD and RSTRAN
    Hope it helps
    bhaskar

  • Need script for getting Uptime for remote servers

    Hi Guys,
    I'm in need of a script to get the UP time for windows servers in number of days. i have more than 1000 servers.
    I dont want PowerShell script as i have many WIndows 2003 servers where PowerShell is not installed.
    Please help me with this.
    Thanks,
    Kiran Raj

    Hi,
    I'd look at the LastBootUpTime property that can be found by querying Win32_OperatingSystem.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

Maybe you are looking for

  • My netbook says my built in webcam for dv6-1259dx does not exist.

    So I tried to use my webcam the otherday but it wouldn't let me, I've been searching for the last two days for a solution but cant find any. It's been fine till the otherday and I haven't done anything nor deleted anything that could have caused it t

  • Can I create an action that will print to a specific printer?

    Hi all, Simple question. I want to create two buttons. One that will print a form to printer 1 (a work printer) and one button that will print to printer 2 (OneNote printer, aka Send to OneNote). Is that possible? No extra options needed, just a quic

  • My TV Shows Used to sort in Chronological order, but now???? Help.

    I have an entire series on my iPod, and it used to display in chronological order. Then I upgraded to the iPod Classic, and now they display in alphabetical order. The sub heading for each show reads, "no release date for this program", but there isn

  • Erratic Wifi Behavior

    I'm not sure if this is something specific to my setup or something that persists in general; but my wifi behaves very oddly. Here is the situation in it's entirety: The iPod touches listed below and for the conditions listed below successfully conne

  • Can't open Indesign files

    I can't open a Indesign file I have been working on for days! Get a message saying tha "filealianses" may be missing! What do I do? BR Nille