Local user last logon time and date in windows – Command

net user username | findstr “logon”

To get all details,

net user username


Advanced audit policy in windows using auditpol.exe

Its preferred to set the advanced audit policy through command prompt/powershell other than GUI. It has to be noted that even after you apply the settings through command, in the gui it might not reflect. But that is not an issue. Thats as far as i know.

Open gpedit.msc/secpol.msc 

  • Computer configuration-security settings-security options
  • Set the policy “Audit:Force audit policy subcategory settings (windows vista or later) to override audit policy category settings” to “Enabled”.

To get full information of advanced audit policy on a server, use the command

  • Auditpol.exe /get /category:*

In that you can see categories and sub categories listed with the status success/failure/not configured.

Few examples below :

  • Auditpol.exe /set /subcategory:”credential validation” /success:enable /failure:enable

The below command will enable only success

  • Auditpol.exe /set /subcategory:”credential validation” /success:enable 

The below commmand will set credential validation to “no auditing”

  • Auditpol.exe /set /subcategory:”credential validation” /success:disable /failure:disable

You can group all of them and save it as a power shell script or a bat h file and run it on required machines.
Please refer to the microsoft link for detailed info : https://technet.microsoft.com/en-us/library//dd408940(v=ws.10).aspx

Windows Server update services – Troubleshooting

  1. Telnet wsus server on port 80 (default) or other as per your environment.
  2. Check windows update log in the location c:\windows\windowsupdate.log
  3. Check if the group policy is correct , gpedit.msc – Local Computer Policy – Computer Comfiguration – Administrative Templates – Windows Components – Windows update –  a)check “specify intranet microsoft update service location” – It should point to your wsus server and the port number should be correct b) Check if “client-side targeting is enabled” (If enabled, the computer will appear under the group name mentioned in wsus server, if not enabled ignore).
  4. Check the proxy settings.
  5. Check firewall.
  6. Delete the software distribution folder from the location c:\Windows\SoftwareDistribution and run the command wuauclt.exe /detectnow.

VMWare ESXi guest – Reduce hard disk size

Everyone knows its easy to increased hard disk size, you just need to type in the amount in GB and expand the size in the OS level. But to reduce it is not straight forward, but can be done.

For example, you have a windows guest machine with c:\20o gb HDD, and you wish to reduce this to 100 gb.

Step 1 : Shrink the C drive in the windows OS to 100 gb and delete the partition and make it free for use.

Step 2: Power off the VMWare guest machine.

Step 3: Open putty and connect to the datastore where the vmware guest machine resides, /vmfs/volumes/..etc….

Step 4: using cat or Vi, open the file named *.VMDK (VMname.VMDK). under extent description, you will find RW 419430400 . The number after RW defines the size of the VMWare guest disk.

The number 419430400 is calculated as follows :

200 GB = 200 * 1024 *1024 *1024 / 512 = 419430400

Step 5: We need to reduce the VMDK file size to 100 GB , so we have to do calculation to find out

100 GB = 100 * 1024 *1024 *1024 / 512 = 209715200

Using Vi , edit the value in the *.VMDk file to 209715200  and save it.

Step 6: Reboot the Guest and you will see that the size of the VMWare guest has been reduced to 100 GB.




cannot update windows server 2012/R2/windows 8/8.1 from wsus 

* Upgrade to WSUS SP2.

* Install the updates KB2720211 and KB 2734608.

* Restart the server and the issue will be fixed.

In case you are not able to install any of the above KB’s  ,

Check for help in the log file in location


If you find the error message ” a network related or instance specific error occured while establishing a connection to sql server. The seever was not found or was not accessible.Verify that the instance name is correct and the sql server is configured to allow remote connections.provider : named pipes provider , error :40 – could not open a connection to sql server” follow the steps below

1. Open Sql Management Studio from Start – All Programs.

2. Are you able to login to sql with the same account you are logged into the computer. If no, then login to sql with the available user and password and add the windows login user to sql login.

* Expand Security

* Expand Logins

* Right click and select “New Login”.

* In the General tab – Enter the login name , select windows authentication.

* In the Server Roles – select the required roles.

* In the User Mapping – Select the database from the list to which the user should have access to.

* Click OK.

3. Login to SQL Management Studio with the new login. Just to check.

4. If you are able to login, then go ahead and install the KB,s .