Solved

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

Posted on 2011-03-09
5
299 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
  • 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

Join & Write a Comment

Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now