How to check start, restart or shutdown time of Windows Operating System

How to check start, restart or shutdown time of Windows Operating System. I found 2 ways to check start,restart or shutdown time of windows operating system.
1. Open command prompt and type below command and press enter. It will show up time of Windows OS.
C:\Documents and Settings\abc> systeminfo
2.We can check in Event Viewer.Open event viewer and go to System Events. Find
System Event ID:1074
The process C:\Windows\system32\shutdown.exe (WIN-6FP1VCCPJ0T) has initiated the restart of computer WIN-6FP1VCCPJ0T on behalf of user PR\Administrator for the following reason: No title for this reason could be found
 Reason Code: 0x800000ff
 Shutdown Type: restart
 Comment:
System Event ID:109 
The kernel power manager has initiated a shutdown transition.
Also check many services are stopped at a particular time.
System Event ID :6005  (This event id means the System went down at that time)
System Event ID :6006  (This event id means the System started at that time)



netcat to transfer files between linux and windows


netcat in windows On Source PC(Windows) download and copy nc.exe  netcat works as a Server and Client model.
Below steps show how to copy data from a Windows system into Linux(Ubuntu) system.Currently I am using Ubuntu Server.Varify
Windows System IP :192.168.xxx.xx  and   Linxu(Ubuntu) system IP: 192.168.yyy.yy
                             Copy files from Windows To Linux
Setp1:Download netcat into Windows System and copy nc.exe into the directory where your file is exist.
Ex: C:\test\nc.exe
Step 2:Install netcat on ubuntu
#apt-get install netcat
Step 3: Now netcat is available on both Windows and Linxu(Ubuntu)
Open command prompt and go to the directory where your file is located and run below command.This will act as a Server.
C:\test> type  backup.iso | nc.exe  -l -p 3333  
Note: "type" is a command in windows.
Step 4: Receive backup.iso on the client machineLinux(Ubuntu) with the following.This will act as a Client
 # nc 192.168.xxx.xx 3333 > backup.iso              
Issue a ^C on the source system and your done one u see file size in destination directory. Be sure to check the file to be sure it is the same size as the original.
                               Copy files from Linxu to Windows 
On Linxu system run below command. Now this will act as a Server
#cat backup.iso | nc -l -p 3333            
On Windows Run below command. Now this will act as a Client.
C:\test> nc.exe 192.168.yyy.yy 3333 > backup.iso
Issue a ^C on the source system and your done one u see file size in destination directory. Be sure to check the file to be sure it is the same size as the original.



Linux filesystem

/ : This(/) is the root folder, all other folders come under root.. it is like C: drive in a Windows OS
/boot : Linux kernel and boot loader configuration files
/usr  : This folder and its sub-folders contains user installed programs and utilities and libraries.It is like
Program files in windows.
/etc  : Configuration files of all installed softwares or applications
/var  : This folder contains files that change alot (“Variable files”). Mail, print web spool files
/tmp  : Temp directory
/home : This folder contains the home folders of all the normal (non – root ) users on the system
/dev  : Device files corresponding to various peripherals of your comp. (hard disk, printer, mouse, modem)
/mnt  : Devices mounted onto OS to increase storage space
/lost+found : Orphan files are moved here
/root : Root's home directory
/proc : Process information pseudo filesystem.
/bin  : various console utilities and apps
/sbin : system administration utilities
/lib  : Shared Library files for your operating system.

netstat : check open ports and connections to system

Using netstat command we can see all the used and listening ports on your computer. NETSTAT command will work in Windows and as well as in Linux Operating System.
Linux
Will Show all connected Ports
netstat -an | grep -i "connected"

Will Show all listening Ports
netstat -an | grep -i "listening"

Will Show all established connections
netstat -an | grep -i "established"

Windows 
Will Show all connected Connected Ports
netstat -an |find /i "connected"

Will Show all listening Ports
netstat -an |find /i "listening"

Will Show all established connections
netstat -an |find /i "established"

Note: -i & /i is used to ignore case-sensitive.

restore grub in vyatta router


grub> linux /boot/vmlinuz root=/dev/sda1
grub> initrd /boot/initrd.img
grub> boot
Agter reboot run below command to re-install grub
grub-install /dev/sda
reboot  ##Reboot again to so that the Server will boot normally

How to manually extend the evaluation period for Windows Server 2008

When the initial 60 or 180 days evaluation period nears its end, you can run the Slmgr.vbs script to reset the evaluation period. To do this, follow these steps:

   1. Login As a Administrator. Click Start, and then click Command Prompt.
   2. Type slmgr.vbs -dli, and then press ENTER to check the current status of your evaluation period.
   3. To reset the evaluation period, type slmgr.vbs –rearm, and then press ENTER.
   4. Restart the computer.
   5. Open Computer Properties.  Right Click on Computer ==> Click Properties ==>At Windows Activation 
       Screen ==>  Click on Activate ==> Click on Activate online ==> Click Next to finish actiavation.

This resets the evaluation period to 60 or 180 as per your last evaluation period.

how to get entire system information in ubuntu

facter : It is a tool to collect and display facts about the current system. The library behind Facter is easy to expand, making Facter an easy way to collect information about a system from within the shell or within Ruby.
#apt-get install facter
#facter and press enter to get the system details
Below is the output of facter
# facter
architecture => i386
facterversion => 1.5.4
hardwareisa => unknown
hardwaremodel => i686
hostname => my-desktop
id => root
interfaces => eth0
ipaddress => 192.168.xxx.xxx
ipaddress_eth0 => 192.168.xxx.xxx
kernel => Linux
kernelrelease => 2.6.31-22-generic-pae
kernelversion => 2.6.31
lsbdistcodename => karmic
lsbdistdescription => Ubuntu 9.10
lsbdistid => Ubuntu
lsbdistrelease => 9.10
lsbmajdistrelease => 9
macaddress => 00:16:ec:da:bc:21
macaddress_eth0 => 00:16:ec:da:bc:21
manufacturer => HP Pavilion 061
memoryfree => 1.28 GB
memorysize => 1.90 GB
netmask => 255.255.255.0
netmask_eth0 => 255.255.255.0
network_eth0 => 192.xxx.xxx.0
operatingsystem => Ubuntu
operatingsystemrelease => 9.10
physicalprocessorcount => 1
processor0 => Intel(R) Pentium(R) D CPU 2.80GHz
processor1 => Intel(R) Pentium(R) D CPU 2.80GHz
processorcount => 2
productname => RC562AA-ACJ a1514in
ps => ps -ef
rubysitedir => /usr/local/lib/site_ruby/1.8
rubyversion => 1.8.7
serialnumber => INI6370L08 AP640
sshdsakey => AAAAB3NzaC1kc3MAAACBAOBuTdUYuMv2b3xqIhWVpuRQunyIm6T5xOYqlZbwuBTi66oZwWTfE5rywsUHQL8CExMaofWFxlo3c+mTcxWIL+68ZjY5NZy5irwAl3g/CL4THtHmDCMbCmvdQLZeePElvYNFcmvC+7o3CbZWC2KU2FnzTCuI9vpG1k51OSiZJtdHAAAAFQDUId/oRXYQ281bZ9J42Wrt3VsbgQAAAIEAn74omuvo4qKjr1PE12HZSA2oeqpFajcGctEyxurQXzpLgjWcgs1ip2phjz6kypDIbELG/nvOComWIABADwnBnErwM0uDpchOkghzCFgR7Hk10Ph1/SQ4Si0y8jKZ9VzPxYzhZp0ekpL15QIutJSTbCG7WzlGRl3eHrY0cVgZVs4AAACABl/PgIPo0u8L2jI0R5wpUql1Tb0Ln+LTMt1HZoqR2gb7dmvI3FvNRbJfEMOy8f5YXeELQz1ppwRS8PpAas3Dh+Deg9dVSzKUTZURqOe4X8TWjrhf3I6jn00zvIjmGk0XhB5ueH3uoQsjogL/uRws1Tqk1wxF/xvt25t8jV1WATQ=
sshrsakey => AAAAB3NzaC1yc2EAAAABIwAAAQEAy6l8d9gOYGQ9CHQoQBmoJ74NDnSZBreIXD/nsAwj93i7pCv9LJ1ifybP7am7kJq3qaHhoU3sB8oaTUUfeXMXGfoHrwRvcIdYFdDKQ7KvjpZU7jWSsKECk0aibaVzqni5sixquLXcjte18T7DU1ki/K/sQPvSQII2Y9EWOAzdzoov4ezj30uer6sR6BkXSR5LK3LW+qoRPKT+xIQMBseJ9TZ8Tz7hpiz1AmcmPNhLj61aK0/1bbRBKzfr8bd8kkI3vkHvfE5Sqzu4VplSCNxa9QNG9jNFCdN/cGCYlL7GdWPNdBP3jzFXeLNgH+bTA82FrBqFaQo5bUOBSSCKFZyuaQ==
swapfree => 5.58 GB
swapsize => 5.58 GB
timezone => IST
type => Desktop
uniqueid => 007f0101
uptime => 4 days
uptime_days => 4
uptime_hours => 109
uptime_seconds => 395539
virtual => physical

sc (service control) command to start/stop any service in windows

SC (service control) command, allows u a lot more options than just start & stop a service
DESCRIPTION:SC is a command line program used for communicating with the NT Service Controller and services.
USAGE: sc  [command] [service name]  ...
Ex: sc query dhcpserver
      sc start dhcpserver
Note:We should know the Service name of any windows service.
Further help on commands can be obtained by typing: "sc [command]"
Commands:
        query-----------Queries the status for a service, or enumerates the status for types of  services.
        queryex---------Queries the extended status for a service, or enumerates the status for types of service.
        start-----------Starts a service.
        pause-----------Sends a PAUSE control request to a service.
        interrogate-----Sends an INTERROGATE control request to a service.
        continue--------Sends a CONTINUE control request to a service.
        stop------------Sends a STOP request to a service.
        config----------Changes the configuration of a service (persistant).
        description-----Changes the description of a service.
        failure---------Changes the actions taken by a service upon failure.
        qc--------------Queries the configuration information for a service.
        qdescription----Queries the description for a service.
        qfailure--------Queries the actions taken by a service upon failure.
        delete----------Deletes a service (from the registry).
        create----------Creates a service. (adds it to the registry).
        control---------Sends a control to a service.
        sdshow----------Displays a service's security descriptor.
        sdset-----------Sets a service's security descriptor.
        GetDisplayName--Gets the DisplayName for a service.
        GetKeyName------Gets the ServiceKeyName for a service.
        EnumDepend------Enumerates Service Dependencies.


useradd in ubuntu

The useradd command will let you add a new user easily from the command line:
#useradd username
Ex : useradd user1
This command adds the user, but without any extra options your user won’t have a password or a home directory. You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory.
We will try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.
#useradd -d /home/user1 -m user1
#passwd user1
Important locations for users
    * /etc/passwd - User account information.
    * /etc/shadow - Secure user account information such as password.
    * /etc/group - Group account information.
    * /etc/default/useradd - Default values for account creation.
    * /etc/skel/ - Directory containing default files.
    * /etc/login.defs - Shadow password suite configuration.

mount windows shared folder from ubuntu

Two methods, depending on share host cifs or smbfs
smbfs is the "original" method.However, smbfs is not compatible with security signatures, which are enabled by default and
not recommended to disable on Windows Server 2003 and later. If a share is served by Windows Server 2003 or later, you should use cifs.
The "smbfs" package provides the tools needed to mount "smbfs" and "cifs" filesytems. You may have smbfs installed on your machine. If not, run

#sudo apt-get install smbfs
Mount Windows Shared folder with windows authentication
#mkdir -p /opt/win-share
#mount -t cifs //192.168.155.xxx/tools/ /opt/win-share/ --verbose -o username=administrator  #this will prompt for administrator password
#mount -t cifs //192.168.155.xxx/tools/ /opt/win-share/ --verbose -o username=administrator,password=****
Mount Windows Shared folder without authentication
#touch win-share-pass
#vi win-share-pass       #open win-share-pass and add below lines on it
username=administrator  #we can specify a user name to access the shared folder
password=********
Save the file

mount -t cifs //192.168.155.117/tools/ /opt/win-share/ --verbose -o credentials=/home/user/win-share-pass

Useful commands for Windows

Type below commands and press Enter in the command prompt  in Window


net view : Display information about the domains, computers, or resources that are shared by the specified computer, including the offline client caching settings.
net share : Create, delete, manage, and display shared resources.
net file : View and control resources that are shared on the network. The Server service must be running for you to use this command.
net config : View the maximum number of users who can access a shared resource and the maximum open files per session.