Solved

How to know what's the last time the server has been accessed?

Posted on 2011-03-09
5
304 Views
Last Modified: 2012-05-11
I have a Windows 2003 server which is closed for a while and I don't know why it was closed. I need to know what is the last time the server has been accessed without open it. Is there a way to check that?
0
Comment
Question by:SAM2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 35089975
What do you mean closed?  Have you looked through the security event logs on the server?

Thanks

Mike
0
 
LVL 1

Author Comment

by:SAM2009
ID: 35090709
By close I mean it turns off but I don't know why it was shutdown that explain I just want to know how to check the last time someone was connected in the server. If it was shutdown for more than 1 year so I will not waste my time and leave it like that.

Could we check last connection in AD?
0
 
LVL 57

Assisted Solution

by:Mike Kline
Mike Kline earned 50 total points
ID: 35090732
If you were to turn it on you could check the event logs on that box

In AD you could check the lastlogontimestamp attribute for that box.  Note that attribute is accurate within 10-14 days   http://blogs.technet.com/b/askds/archive/2009/04/15/the-lastlogontimestamp-attribute-what-it-was-designed-for-and-how-it-works.aspx

Thanks

Mike
0
 
LVL 5

Accepted Solution

by:
rov17 earned 200 total points
ID: 35093358
Hi ,
We using the below VB script to audit users logs on, assign the script as a log in to all users, or assing in to the ou that the server in and enable loop back.

Hope that helps

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
    SerialNumber = trim(objItem.SerialNumber)
Next

Dim Manufacturer 
Dim Model 
Dim MachineName  
Dim SerialNumber 
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
	Manufacturer = Trim(objItem.Manufacturer) ' manufacturer
    Model = trim(objItem.Model)		' pc model
    MachineName  = trim(objItem.Name)		' computer netbios name

Next

Dim TotalVisibleMemory 
Dim OperatingSystemAndServicePack 
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem In colItems
   cOSs = objItem.Name
   pos = InStr(1, cOsS,"|",1)
   cOS1 = left(cOSs,pos-1)
   OperatingSystemAndServicePack =  cOS1 & " " & objItem.CSDVersion
   'TotalVisibleMemory = objItem.TotalVisibleMemorySize
   TotalVisibleMemory = FormatNumber(objItem.TotalVisibleMemorySize/1024,0) + " MEG" 
Next


Dim ProcessorAndClockSpeed 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
ProcessorAndClockSpeed= trim(objItem.Name) & " /" & objItem.CurrentClockSpeed & " MHz"
Next

Dim UserName
set oNet = CreateObject("WScript.Network") 
UserName = oNet.UserName

set wshShell1=Wscript.CreateObject("Wscript.Shell")
set logonserver= WshShell1.ExpandEnvironmentStrings("%logonserver%")




UpdateList UserName,MachineName,Manufacturer,Model,SerialNumber,ProcessorAndClockSpeed,TotalVisibleMemory,OperatingSystemAndServicePack,Width,Height,WshShell1.ExpandEnvironmentStrings("%logonserver%")


Function UpdateList(UserName,MachineName,Manufacturer,Model,SerialNumber,ProcessorAndClockSpeed,TotalVisibleMemory,OperatingSystemAndServicePack,Width,Height,logonserver)
	Dim filename
	filename = "\\share\Logon.csv"
	Const Appending = 8
	Const a = """" ' used at begginging & end
	Const b = """,""" ' used everywhere else.
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set f = fso.OpenTextFile(filename, Appending, False)
	f.WriteLine(a &UserName& b & MachineName & b & Manufacturer& b & Model& b & SerialNumber& b & ProcessorAndClockSpeed& b & TotalVisibleMemory& b & OperatingSystemAndServicePack& b & Width& b & Height& b & logonserver& b &Now()& a)
	f.Close

end Function

Function ScreenResolution()
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Navigate("about:blank")
Do Until .readyState = 4: wscript.sleep 100: Loop
width = .document.ParentWindow.screen.width
height = .document.ParentWindow.screen.height
End With
oIE.Quit
ScreenResolution = array(width,height)
End Function

Open in new window

0
 
LVL 1

Author Closing Comment

by:SAM2009
ID: 35112941
Many thanks!
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Suggested Courses

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question