Create hotspot in Windows by CMD

#You must run your cmd as administrator

Check whether your hardware (adapter) supports hotspot or not
netsh wlan show drivers

Create hotspot with ssid Hotspotname and key 12345678
netsh wlan set hostednetwork mode=allow ssid=MyHotspot key=12345678

Start your hotspot so that your wireless devices like laptop or smartphone can connect to it
netsh wlan start hostednetwork

You can also stop your hotspot
netsh wlan stop hostednetwork

You can also show information about your hotspot
netsh wlan show hostednetwork

Microsoft How to use “xcopy” comamnd to copy all data from one volume to another, including hidden and system files

​You can use xcopy to copy all data from one volume to another, including hidden and system files, using the command

xcopy <source volume> <target volume> /s /e /r /c /h /k /o /x /y  

The switches mean:

  • /s—system files
  • /e—copies folders and subfolders, including empty ones
  • /r—overwrites read-only files on destination
  • /c—continue on errors
  • /h—hidden files
  • /k—copy all attributes
  • /o—copy file ownership and ACL information
  • /x—copy file audit settings
  • /y—suppress prompt to overwrite existing file

How to create a bootable USB drive without additional/third-party tool

# How to create a bootable USB drive without additional/third-party tool
# Prerequisite:
# USB (g:) -> disk 2 (in diskpart)
# CD Windows 7 (d:)

# run "diskpart" as administrator
select disk 2
create partition primary
format fs=ntfs quick

# run "cmd" as administrator
cd d:
cd boot
bootsect.exe /nt60 g:
xcopy d:\ g:\ /s /e /r /c /h /k /o /x /y

# Let have fun 🙂

# Note: It would work the same for Windows 8 or 10

Using command “forfiles” in Windows

C:\Users\Vichhaiy>forfiles /?

FORFILES [/P pathname] [/M searchmask] [/S]
[/C command] [/D [+ | -] {MM/dd/yyyy | dd}]

Selects a file (or set of files) and executes a
command on that file. This is helpful for batch jobs.

Parameter List:
/P pathname Indicates the path to start searching.
The default folder is the current working
directory (.).

/M searchmask Searches files according to a searchmask.
The default searchmask is ‘*’ .

/S Instructs forfiles to recurse into
subdirectories. Like "DIR /S".

/C command Indicates the command to execute for each file.
Command strings should be wrapped in double

The default command is "cmd /c echo @file".

The following variables can be used in the
command string:
@file – returns the name of the file.
@fname – returns the file name without
@ext – returns only the extension of the
@path – returns the full path of the file.
@relpath – returns the relative path of the
@isdir – returns "TRUE" if a file type is
a directory, and "FALSE" for files.
@fsize – returns the size of the file in
@fdate – returns the last modified date of the
@ftime – returns the last modified time of the

To include special characters in the command
line, use the hexadecimal code for the character
in 0xHH format (ex. 0x09 for tab). Internal
CMD.exe commands should be preceded with
"cmd /c".

/D date Selects files with a last modified date greater
than or equal to (+), or less than or equal to
(-), the specified date using the
"MM/dd/yyyy" format; or selects files with a
last modified date greater than or equal to (+)
the current date plus "dd" days, or less than or
equal to (-) the current date minus "dd" days. A
valid "dd" number of days can be any number in
the range of 0 – 32768.
"+" is taken as default sign if not specified.

/? Displays this help message.

FORFILES /S /M *.txt /C "cmd /c type @file | more"
FORFILES /P C:\ /S /M *.bat
FORFILES /D -30 /M *.exe
/C "cmd /c echo @path 0x09 was changed 30 days ago"
FORFILES /D 01/01/2001
/C "cmd /c echo @fname is new since Jan 1st 2001"
FORFILES /D +9/3/2015 /C "cmd /c echo @fname is new today"
FORFILES /M *.exe /D +1
FORFILES /S /M *.doc /C "cmd /c echo @fsize"
FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"

*Delete files older than 30 days:
forfiles -p "C:\what\ever" -s -m *.* /D -30 /C "cmd /c del @path"

Active Directory – How to reset password for all specified users

Download PowerShell Script


The script will reset password for users in specified OUs, or in a given CSV file.


IT Administrators may want to reset password for a large number of users in company. It will cost too much time to set new password one by one. Sometimes the new password should be a random password and different for every user. It’s easy to make mistake in manually way.


This module file contains three advanced function, Set-OSCADAccountPassword. You can use this script in following ways:
1. Open Powershell in “Run as administrator” mode.
2. Run command Import-Module “c:\ResetPassword.psm1” to import this module file.

Note Assuming you downloaded this file in the drive C directly.


Example 01: How to displays help about the Set-OSCADAccountPassword function
To display help about theSet-OSCADAccountPassword function, run the following command:
Get-Help Set-OSCADAccountPassword -Full

Example 02: How to reset password for specified users.
To reset password for specified users, should put these user’s SamAccountName in a CSV file, then run the following command:
Set-OSCADAccountPassword -path “c:\Userlist.csv”
Note first, you need to prepare a CSV file,its format appears as below. One user per line. The “Password” column is optional, if you leave it empty, this command will help you to generate a random password with 10 characters, 7 char are alphanumeric, the rest are NONalphanumeric. Both format A and format B are allowed

SamAccountName Password
SamAccountName of user, who should reset password The new password you want to set

Format A Format B
Before run this command, prepare a CSV file show as below:

Then run the command: Set-OSCADAccountPassword -path “c:\Userlist.csv”

Finally, a CSV file will be created on “C:\”, which contains user SamAccountName and new password.

Example 03: How to reset password for all users in specified OUs and their sub OU
To reset password for all users in specified OUs and their sub OU, run the following command:
Set-OSCADAccountPassword –OrganizationalUnit “testou1”, “testou2” -Recurse

Note AD structure show as below

Example 04: How to reset password to “P@Ssw0rd” for all users in specified OU, and indicate the path of result CSV file.
To reset password to “P@Ssw0rd” for all users in OU “TestOU” and indicate the path of CSV file to “c:\report\result.csv”, run the following command:
Set-OSCADAccountPassword –OrganizationalUnit “testou” -Password “P@Ssw0rd” –CSVPath “c:\report\result.csv”


How to schedule your computer to shutdown using batch script (.bat)

This is an easy batch script (.bat) to shutdown your Windows with specific time you want with the alert message 60 seconds before it executes.

To do so, create a batch file (anyname.bat) with the following content:

@echo off
if %time%==17:00:00.00 goto :X
goto :W
shutdown.exe /s /f /t 60 /c "Your computer will shutdown in 60 seconds, please save your tasks."

Enjoy 🙂

Print slides with or without speaker notes

It’s actually simpler to print slides without speaker notes than with them – in fact, there is only one way to print speaker notes with slides.

  1. Click the File > Print.
  2. Under Settings, click the second box (which defaults to say Full Page Slides), then under Print Layout, clickNotes Pages.
    Print speaker notes
    Notes Pages prints one slide per page, with speaker notes below. The Preview Pane shows you what each layout option looks like.
  3. Put in the other settings, such as which slides you want, how many copies, and so on.
  4. Click Print.

The other options under Print Layout, and all of the options under Handouts, print only slides or slide content, not speaker notes.

To learn more about printing PowerPoint slides, see Print a presentation in black and white or grayscale.


About User Profiles in Windows system

The system creates a user profile the first time that a user logs on to a computer. At subsequent logons, the system loads the user’s profile, and then other system components configure the user’s environment according to the information in the profile.

Types of User Profiles

  • Local User Profiles. A local user profile is created the first time that a user logs on to a computer. The profile is stored on the computer’s local hard disk. Changes made to the local user profile are specific to the user and to the computer on which the changes are made.
  • Roaming User Profiles. A roaming user profile is a copy of the local profile that is copied to, and stored on, a server share. This profile is downloaded to any computer that a user logs onto on a network. Changes made to a roaming user profile are synchronized with the server copy of the profile when the user logs off. The advantage of roaming user profiles is that users do not need to create a profile on each computer they use on a network.
  • Mandatory User Profiles. A mandatory user profile is a type of profile that administrators can use to specify settings for users. Only system administrators can make changes to mandatory user profiles. Changes made by users to desktop settings are lost when the user logs off.
  • Temporary User Profiles. A temporary profile is issued each time that an error condition prevents the user’s profile from loading. Temporary profiles are deleted at the end of each session, and changes made by the user to desktop settings and files are lost when the user logs off. Temporary profiles are only available on computers running Windows 2000 and later.

How to Install Active Directory on Windows Server 2012 from Server Manager

As a Linux Sysadmin, you might still end-up dealing with few Windows Servers.

One essential sysadmin tasks on Windows Server is to install and configure AD.

Typically, we use the DCPROMO.exe command in Windows server 2003/2008 to install the Active directory services.

But, in Windows server 2012, Microsoft has removed DCPROM.exe command and redirected the Active Directory installation to Server manger.

AD installation is now divided into the following two parts:

  1. Install Active directory
  2. Promote server as Domain controller

I. Install Active Directory

1. Add Roles and Features

First, Open server manager-> Select Add roles and features from Dashboard/Mange options.

AD Server manager add roles

Select next on Add Roles and Features Wizard page.

2. Installation Type

Select Role based features option in Add Roles and Features Wizard page. Do not select “Remote Desktop Services Installation” type.

AD Select installation type

3. Select Server and Server Role

Select the server from the server pool. It will automatically show the server in the list. Typically, you’ll see only your server in this list.

Select Active Directory Domain services in Roles list as shown below.

AD Select server roles

4. Add Features

After selecting Role it will popup a window to install additional services, Choose add features from popup window.

If you want to install any other additional features we can select from this page.

5. Install AD

Select next in Add Roles and Features Wizard page.

Confirm the installation selections. Check the Restart check box to restart server automatically after installation.

AD Installation progress

II. Promote Server as Domain Controller

6. Server Notification to Promote

After installing Active directory services, select Promote server to a domain controller from the server notification page.

AD Server notification

7. Deployment Configuration

Select Deployment option as per your requirement. Here I am installing first Active directory in my network so I am selecting Add a New Forest.

AD Deployment configuration

8. Domain Controller Options

Select forest and domain functional level. You’ll also set your DSRM password here.

Next screen is DNS delegation, If you have any other DNS in your network you can delegate the DNS options. This screen might display this message: “A delegation for this DNS server cannot be created because the authoritative parent zone cannot be found”

AD Domain controller options

9. NetBIOS and Directory Path

Enter NetBIOS name in the next screen.

Next, Select the folder path for Active directory database files, By default it will be stored in “C:\Windows\NTDS” folder.

Finally, review all your options and press next.

AD Directory paths

10. Active Directory Console

Before prompting server as Domain controller it will check all the prerequisite, If any prerequisite is not installed means it will not start the installation until to complete the prerequisite installation. After completing installation reboot the server, If you checked the reboot automatically option means it will get restart automatically,

Finally, after the installation, you can launch the Active directory console as shown below.

AD Console