Windows Server 2022: How to set up disk quota

Following our disk quota overview article, we will now look at how to set up and configure a simple use case for quota management in Windows Server 2022.

At the most basic level, quotas can be applied to an entire disk volume for specified users or everybody.
Note: The best practice is to refrain from enabling disk quotas on the drive where the operating system is installed. In our examples below, an additional drive has been connected where the permissions will be applied.

Disk quotas for all users

In our first example, we will enable disk quotas for all users accessing the server.

  • To enable this, open Windows Explorer.
  • Select This PC.

  • Right-click on the drive where the quota will be enabled and select Properties.

  • Under Properties, select the Quota tab.
  • Tick the box next to Enable the quota management.
  • Tick the box next to Deny disk space to users exceeding the quota limit.

  • Select the radio button Limit disk space to (This will allow setting a disk limit and warning level.)
  • Select a value and select KB, MB, or GB from the dropdown as per requirements.
  • Click Apply and restart the computer.

    All users accessing this disk will now be limited to the storage limit applied.

Disk quotas for specific users

In our second example, we will enable disk quotas for specific users accessing the server.

  • To enable this, open Windows Explorer.
  • Select This PC.

  • Right-click on the drive where the quota will be enabled and select Properties.

  • Under Properties, select the Quota tab.
  • Tick the box next to Enable the quota management.
  • Tick the box next to Deny disk space to users exceeding the quota limit.
  • Select the radio button Limit disk space to  (This will allow setting a disk limit and warning level. )
  • Select a value and select KB, MB, or GB from the dropdown as per requirements.
  • Click Apply.
  • Click on the Quota Entries button.
  • When the Quota Entries open, select Quota on the top left and click New Quota Entry.
  • Enter a username to search for and click Check Names.
  • In our example, we have created a local user on the server with the name “Quota.”
  • When the name is found, click OK.
  • A pop-up will appear to apply a quota.
  • Select the radio button next to Limit disk space to (This will allow setting a disk limit and warning level. )
  • Select a value and select KB, MB, or GB from the dropdown as per requirements.
  • Select the desired values and click OK.
  • A new quota has been applied for the specified user.

Conclusion

Now that quotas are in place, limits can easily be increased or decreased in both scenarios.
Should you no longer wish to limit space, untick the two tick boxes in reverse order.
First, untick Deny disk space to users exceeding quota limit, and then untick Enable quota management.

WINDOWS SERVER 2022: ACTIVE DIRECTORY BACKUP AND RESTORE

Microsoft’s Active Directory is one of the most widely used directory services. This service is an excellent way to manage small to enterprise-scale organizations.
Ensuring that you have a working backup is vital to business continuity.

Let’s discuss a basic example of backing up and restoring.

To be able to follow along with this, you will need to have a Windows server with Active Directory already set up. Please refer to our guide here.
A second hard drive attached to the machine is also required.

Windows Server Backup

Windows Server Backup is free with Windows Server and will be used for this example. The general ideas of the solution would be the same even if other backup software were used.

Installing Windows Server Backup

Open the Server Manager, select Manage and then Add Roles and Features.

When the wizard opens, click Next.

Select the radio button for Role-based or feature-based installation and click Next.

If only one server exists, the correct one will already be selected.
If there is more than one server, ensure the correct one is selected.
Click Next.

No changes need to be made to the server roles page; click Next.

On the features page, scroll down and select Windows Server Backup.

Once the tick mark shows in the box, click Next.

As this is a test environment, the option to restart automatically was selected.
Note: Use automatic restart with caution in a production environment.

If the automatic restart was selected, select Yes and then click Next.

The Windows Server Backup feature will now install.

Windows Server Backup: Once-off

Once the installation has been completed, there are multiple ways to open Windows Server Backup.
The application can be found on the start menu, in the Tools list in Server Manager, and via the command line.

Once open, select Local Backup on the left.

Once loaded, select Backup Once on the right.

In the backup wizard, ensure Different options are selected and click Next.

Select the Custom radio button and click Next.

Click Add Items

Tick the box next to System state and click Ok.

For the destination, select Local drives and click Next.

The wizard should automatically select the second hard drive.
Should this not occur, select the correct drive from the drop-down list and click Next.

The wizard will confirm that only the system state is to be backed up. Click Backup.

The backup will run. Once completed, click Close.

The one-off backup is now complete.

Windows Server Backup: Scheduled

In the Windows Server Backup client, select Backup Schedule on the right-hand side.

When the wizard opens, click Next.

In this example, we will select a Full server backup and click Next.

For our lab, one daily backup is sufficient.
Select a suitable time for the backup to run and click Next.

To back up to the second hard drive, select Back up to a hard disk and click Next.

Click the option to Show All Available Disks.

Tick the box next to the disk where the backup will run and click Ok.

Once back at the disk selection, ensure the box is ticked next to the disk and click Next.

As this is a complete system backup, Windows will need confirmation to remove the drive so backups can be added.

Note that Windows will prompt you to format the disk. Click Yes.

Click Finish to create the scheduled backup.

Note: Once-off backups and scheduled backups cannot reside on the same drive.

Active Directory Restore

In our example, we’ve created a user account. This user account was then erroneously deleted.
Note: For this example, we will restore from the system state backup above.

As visible in the below screenshot, the user is no longer visible.

To restore our missing user, we must restart our Domain Controller in safe mode.
Open the run command, type MSConfig, and click Ok.

When the System Configuration opens, select the Boot tab.
On the boot page, tick the box next to Safe boot and ensure the Active Directory repair radio button is ticked, then click Ok.

Click Restart

After restarting into safe mode, only some of the domain services are running.
If you try to log in with a domain account, it will fail with the below error.
Click Ok.

Select Other user on the lower left of the login screen.

Log in to the server with the local administrator account from server installation.
Login requires the format of .\admin_account_name (the .\ changes log-in from the domain to the local computer).

To confirm that the server has started in Safe mode, note the text in the four corners.

To restore the deleted user account, open Windows Server Backup.

Once open, select Local Backup on the left-hand side and choose Recover on the right-hand side.

When the wizard opens, select This server and click Next.

Select an appropriate backup to restore from and click Next.

Select System state and click Next.

Select the radio button to restore to the Original location, tick the box to perform an authoritative restore, and click Next.

Click Ok on the warning.

Confirm that the wizard will restore the system state and click Recover.

The wizard will warn against canceling or pausing the recovery; confirm by clicking Yes.

The recovery process will take some time to complete.

Once complete, the wizard will offer a restart option.
Do not select this.
Open the run command again, enter MSConfig and click Ok.

Navigate to the Boot tab again.
Untick the box next to Safe boot and click Ok.

Select Restart.

After restarting, log in again with a domain administrator account, not the local administrator account used during the previous restore steps.

After login, a message will prompt that the recovery has been completed successfully.
Hit Enter to continue.

To confirm that the restore was successful, navigate to the Active Directory Users and Computers.

When opening the Users, we can see that the user account has been restored.

Conclusion

The ability to back up and restore Active Directory is crucial to any disaster recovery plan. Ensure that backups are created regularly. Restores should also be tested regularly to ensure no corruption.
Wherever possible, have multiple domain controllers running to minimize downtime in the event of failure.

WINDOWS SERVER 2022: INSTALLING ACTIVE DIRECTORY

Microsoft’s Active Directory (AD) offers many global corporations an enterprise-grade Single Sign-On environment.
Knowing how to configure this on the latest version of Windows Server will always benefit any IT professional.
In this article, we will discuss the initial setup of Active Directory.

Note 1: This was set up in a test environment; please always be cautious while working in a production environment.
Note 2: IP addresses listed are from the test environment; please ensure to match your environment.

Prerequisites

Processor

A 1.4 GHz 64-bit processor compatible with the x64 instruction set.
Support NX (no execution) and DEP (Data Execution Prevention).
Supports second-level address translation such as EPT and NPT.

RAM

At least 512MB (if a server with a desktop environment is installed, a minimum of 2GB is needed).
RAM with error-correcting code (ECC).

Storage

PCI Express storage adapter.
Hard disks can have a minimum partition requirement of 32GB.

Network

Any adapter that can use gigabit throughput.
PCI Express compliant adapter.
A card that supports a Pre-Boot Execution Environment (PXE).
A network debugging-enabled card is desirable but not a requirement.

Installation

To install Active Directory, Server 2022 must be installed and fully updated.

After the updates are installed, open the Server Manager application.
Once open, select the Ethernet connection so a static IP address relevant to the environment can be set.


Select the Ethernet adapter and open the Properties.
Under properties, select the TCP/IPv4 and click Properties.

Select the radio button to Use the following IP address.
Specify a free IP address in the network, as well as the subnet mask and correct default gateway, and click OK

Next, select the computer name under the Server Manager to change it.
The server will need a valid name before installing Active Directory.

On the System Properties window that opens, select Change.

Create a meaningful name for the server in our example DC1 and click OK.

Click Ok to acknowledge that the computer needs to be restarted.

Click Restart Now

After restart, the new IP address and computer name are visible when checking the Server Manager.

In the Server Manager, select Manage, and then Add Roles and Features

The wizard will give basic information; click Next.

Select Role-based or feature-based installation and click Next.

Should there be multiple servers in the environment, ensure the correct server is selected and click Next.
Should there only be one server, the above can be ignored. Just click Next.

On the server roles list, select Active Directory Domain Services.

Leave the tick box ticked to Include management tools, and click Add Features.

Active Directory Domain Services will now be ticked. Click Next.

For the Features, click Next with no changes.

The Active Directory Domain Services will make some suggestions that are very important for production environments, namely:
Install a minimum of two domain controllers so users can log in even if there is a server outage.
A Microsoft DNS server must be set up in the network.
Click Next.

Ticking the option to restart automatically for test environments will speed up the installation process. This should be used with caution for production environments.
Click Install.
If the option to restart was selected, click Yes to allow the automatic restart.

Installation of the Active Directory Domain Services will now run.

Once completed, select the option to Promote this server to a domain controller.

As this is a new domain, we will create a new forest.
For the root domain name, it is best to use a subdomain of an existing public FQDN (Fully Qualified Domain Name).
For example, adtest.foldersecurityviewer.com.
Should you not have a public domain, replacing the .com on the end with .local will work for test domains.

When setting up the domain controller for the first time, certain decisions will need to be made.
Forest Functional Level is the minimum Operating System version for all servers in all sub-domains.
Domain Functional Level could be set higher than the Forest level, but not lower.

Conclusion

We hope that this guide will help you on your journey to Active Directory setup and administration.

How to close open files on Windows Server 2022

Every Microsoft Windows Server system administrator will, at least once, encounter a situation where a file is open on a server and need to check which process or user opened it.

These open files can cause problems such as upgrade errors, maintenance errors, reboot hold up, etc.

A typical example is an end-user opening a shared file, and no other users can access it.

Below we will discuss different options to close open files and processes.

These steps work with Microsoft Windows Server 2008, 2012, 2016, 2019, 2022, Windows 10, and Windows 11.

VIEW OPEN FILES ON A SHARED FOLDER

Right-click on the start menu and select Computer Management.

Alternatively, search for:

 compmgmt.msc

Click on Shared Folders, and then Open Files.

This menu displays open shared files, the user who opened it, possible locks, and the mode opened in.

Right-click on a file and select Close open File.

USE WINDOWS TASK MANAGER

Task Manager cannot close opened shared files, but it can end running processes on the system.

Task Manager can be accessed via Control + Alt + Delete and select Task Manager, or right-click the taskbar and select Task Manager.

Under the Processes tab, you will see all running processes. To terminate a running process, right-click it and select End Process.

RESOURCE MONITOR

Resource Monitor is accessed by typing “resource monitor” in a start menu search box or opening the task manager, clicking the performance tab, and clicking Open Resource Monitor.

When Resource Monitor opens, it will show tabs, and one, needed for this operation is Disk.

The Resource Monitor shows disk activity and processes, files that are open, process ID number, read and write bytes per second, etc. This information is helpful to identify open files and running processes.

POWERSHELL CMDLET

In most cases, PowerShell is better than GUI-based applications. Multiple commands can be used to close open files and processes.

There is more than one solution with PowerShell scripts, and administrators without experience in scripting are recommended to use GUI options instead.

Below are some possible solutions with PowerShell.

The following examples are for Server Message Block (SMB) supported systems.

This cmdlet can be used when a small number of known open files should be closed. It is, as usual, used from elevated PowerShell and applies to a single file ( note that all unsaved data on open files will not be saved).

 Close-SmbOpenFile -FileId ( id of file )

Confirm

Are you sure you want to perform this action?

Performing operation ‘Close-File’ on Target ‘( id of file)’.

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”): N

Closing files for a specific session can be achieved with the below-edited script.

 Close-SmbOpenFile -SessionId ( session id )

This command closes all open files under the ID of the specific session.

The other variation of the same cmdlet applies to a file name extension ( for example, DOCX).

The command will check all opened files with DOCX extension on all system clients and force close it. Unsaved changes on open files will not be saved.

 Get-SmbOpenFile | Where-Object -Property ShareRelativePath -Match ".DOCX" | Close-SmbOpenFile -Force

POWERSHELL SCRIPT

PowerShell scripts can automate closing open files and stopping running processes.

The below example script enables closing a file specified by path. This path needs to be provided in the script.

There is more than one solution with PowerShell scripts, and administrators without experience in scripting are recommended to use GUI options instead.

$blok = {$adsi = [adsi]"WinNT://./LanmanServer"
$resources = $adsi.psbase.Invoke("resources") | Foreach-Object {
  New-Object PSObject -Property @{
  ID = $_.gettype().invokeMember("Name","GetProperty",$null,$_,$null)

Path = $_.gettype().invokeMember("Path","GetProperty",$null,$_,$null)

OpenedBy = $_.gettype().invokeMember("User","GetProperty",$null,$_,$null)

LockCount = $_.gettype().invokeMember("LockCount","GetProperty",$null,$_,$null)

}

}

$resources | Where-Object { $_.Path -like '*smbfile*'} |ft -AutoSize

$resources | Where-Object { $_.Path -like '*smbfile*'} | Foreach-Object { net files $_.ID /close }

}

Invoke-Command -ComputerName pc1 -ScriptBlock $blok 

COMMAND LINE

From a standard Command Prompt, the Net File command can be used to close open files. To run this remotely, Psexec.exe is required

Net File command can list all open shared files and the number of file locks per file. This command can be used to close files and remove file locks ( similar to the previous SMB example).

 C:>net file [id [/close]] 

RELEASE A LOCKED FILE

Should users encounter an error that a file is locked, an administrator will be able to resolve this by opening the Microsoft Management Console

Search for:

 mmc

Select File, then Add/Remove Snap-in and add the Shared Folders snap-in.

This snap-in can be run on a local computer or a remote computer.

Select locked/open file, right-click and select Close open file.

THIRD-PARTY TOOLS

Below is a list of some of the most commonly used third-party applications for managing open files.

PSFILE

PsFile is part of the PSTools package from Microsoft Sysinternals. This tool is similar to the Net File mentioned earlier.
This tool gives the ability to connect to a remote server and see open files.
Note: Unlike Net File, this tool cannot truncate file names.

 psfile [\\RemoteComputer [-u Username [-p Password]]] [[Id | path] [-c]]

Sysinternals website: https://docs.microsoft.com/en-us/sysinternals/

Process Explorer

Another featured application from Microsoft Sysinternals. This advanced Task Manager can close open files, amongst many other features.
Sysinternals website: https://docs.microsoft.com/en-us/sysinternals/

OpenedFilesView

This single-executable application shows all open files and gives the ability to close open files and end processes. Though not explicitly listed on the website, this has been successfully tested on Windows Server 2022.
OpenedFilesView website: https://www.nirsoft.net/utils/opened_files_view.html

Lockhunter

Primarily used for deleting blocked files, it is also possible to use Lockhunter as a workaround to unlock files. Though not explicitly listed on the website, this has been successfully tested on Windows Server 2022.
Lockhunter website: https://lockhunter.com/

UnLock IT

Another popular tool designed to close open and locked files is UnLockIT. Though not explicitly listed on the website, this has been successfully tested on Windows Server 2022.

UnLock IT website: https://emcosoftware.com/unlock-it

Long Path Tool

Unlike the other utilities listed here, Long Path Tool is a shareware program. As the name suggests, it helps fix issues when a file path is too long. Those issues include not being able to copy, cut, or delete the files in question because their path is too long. This application does require the Dot Net 3.5 feature to be installed in order to run on Microsoft Windows Server 2022.
With so many features, the functionality in this tool could be overkill for this specific purpose, but worth mentioning as it is a quality tool for all system administrators.

Long Path Tool website: https://longpathtool.com/

How to create junction links on Windows Server 2022

Windows contains three types of file links.

Hard links: Creates a second directory entry to a file such that it can reference a file using more than one reference path.

Symbolic links: Creates a new file altogether that references an already existing file

Junction links: Creates a link between directories on different volumes or drives, but not between network drives. This link is only possible between folders.

Create a junction link on Windows Server 2022

Creating a junction link will link two folders together.

In our tutorial, we will create a junction link between the below two locations:

C:\NewJunction

and

C:\Users\Administrator\Download\Junction

To create the link, search for the Command Prompt, right-click on it, and select “Run as administrator.”

Graphical user interface, application

Description automatically generated

Next, use the mklink command in the below syntax:

mklink /J “junction path link” “target folder path

In our example, that would be as follows:

Note: The target folder must be created prior to running this command.

mklink /J “C:\Junction” “C:\Users\Administrator\Downloads\TestSetup”

The junction link is now created.

Text

Description automatically generated

Verify the link by running the below command:

dir /al /b

Graphical user interface, text

Description automatically generated with medium confidence

Alternatively, running the below command will list all directories and junctions

dir

Graphical user interface, text, website

Description automatically generated

Hide Windows Server 2022 junction links

To create a junction link with the target folder hidden, the below command can be used:

mklink /J …::$INDEX_ALLOCATION target folder

To confirm that the link is created as hidden, run either of the below commands:

dir 

dir /al /b

The destination will be listed as “…”

Text

Description automatically generated

Delete Windows Server 2022 junction links

To delete an unused junction link, use the below command:

rmdir path to junction link

Note: Deleting a link will not delete the target folder or the files in the target location.

How to install and configure NTP Server on Windws Server 2022

NTP, or Network Time Protocol, is a service that has access to highly precise atomic clocks. As a result, the NTP service provides consistent timekeeping on client and server resources and ensures accurate data logging. The purpose of this is to streamline global communications.

Below, we’ll discuss the process of installing, configuring, and querying an NTP server on Windows Server 2022.

INSTALL AND CONFIGURE AN NTP SERVER ON WINDOWS SERVER 2022

Follow the straightforward steps below to configure an NTP server on Windows Server 2022.

Confirm NTP service is Automatic

Open the Run dialogue (Windows key + R) and type “services.msc” (without the quotation marks) and click OK or hit Enter.

Graphical user interface, text, application

Description automatically generated

Locate “Windows Time” under the Services. Right-click the service and select Properties.

Graphical user interface, text, application, email

Description automatically generated

Change the Startup type to “Automatic”.

Graphical user interface, text, application, email

Description automatically generated

Once Startup type is confirmed, click “OK”.

NTP server registry configuration

Open the Run dialogue (Windows key + R) and type “regedit” (without the quotation marks) and click OK or hit Enter.

Graphical user interface, application

Description automatically generated

The registry editor will open as below.

Text, table

Description automatically generated with medium confidence

Navigate to the below location:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer

In the pane on the right-hand side, double-click on the entry titled “Enabled”.

Graphical user interface, table

Description automatically generated with medium confidence

Change the DWORD value to “1”, leave the Base as Hexidecimal, and click “OK”

Graphical user interface, application, Word

Description automatically generated

Now browse to the below location:

Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>Config

In the right-hand pane, locate the “Announce Flags” entry.

Table

Description automatically generated with low confidence

Change the DWORD value data to “5”, leave the Base as Hexidecimal, and click “OK”

Graphical user interface, text, application

Description automatically generated

Return to the “services.msc”, locate the “Windows Time” service again, right-click on it and restart the service.

Graphical user interface, text, application, email

Description automatically generated

Configure NTP with PowerShell

Launch an administrator PowerShell session and run the below:

Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer” -Name “Enabled” -Value 1

Configure Announce Flags value:

Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Config” -Name “AnnounceFlags” -Value 5

Restart the NTP server:

Restart-Service w32Time

Text

Description automatically generated

Note: NTP requires UDP port 123 open for Windows Server 2022 to be able to reach the clocks. If the servers are unreachable, please check your firewall configuration.

Useful Commands

Check NTP Configuration:

w32tm /query /configuration

Check NTP server list:

w32tm /query /peers

Force NTP server synchronization:

w32tm /resync /nowait

Show the source of the NTP time:

w32tm /query /source

Show status of NTP service:

w32tm /query /status

Conclusion

Windows Server 2022 is now configured to synchronize with pool.ntp.org. Therefore, all infrastructure should now be synchronized with the local NTP server.
Should NTP be configured on a virtual machine, ensure that the machine is set to only sync from the time service and not with the host machine.

10 Useful and Exciting Windows Command Prompt Tricks

With a beautiful interface such as that of Windows 10, it’s quite easy to forget the marvels that come with the Windows command prompt (CMD) nifty tool.

While the command prompt may appear mysterious and intimidating for some people, it’s easy to make the most of the tool.

In this tutorial, you will learn some exciting Window 10 tricks that you can use to improve your overall performance.

1. Copy output of CMD to the clipboard

Occasionally, you may want to copy and share the information or output of the command prompt after running commands. Instead of taking a screenshot, you can copy the output and paste it on a text editor.

Here is the syntax:

command | clip

For example, to copy the output of ipconfig command, run:

Ipconfig | clip

You can then launch Notepad or any other text editor and paste the contents:

2. Change the title of the command prompt tool

By default, the title of the command prompt bears the title names Command Prompt or Administrator: Command Prompt, as shown below:

When it’s run as an Administrator, the title appears as shown below:

If you wish to customize it to your own preference, run this command:

title preferred-name

For instance, to change the title to a username ‘james’, run:

title james

3. Watch Star Wars in ASCII format on command prompt

One of the coolest features of the command prompt is the ability to stream an ASCII version of Star Wars. The method is quite simple and utilizes the telnet protocol.

To view Star Wars in ASCII format, execute the command below and hit ‘Enter’:

telnet towel.blinkenlights.nl

Shortly after, Star Wars in ASCII version will be launched:

NOTE:

Before you begin launching Star Wars, ensure that Telnet feature is enabled in Windows Features. You can go to Control Panel > Programs > Programs and Features.

On the left pane, click on ‘Turn Windows Features on or off’. Then, scroll and check the telnet option to activate the telnet protocol.

4. Change the text or background color of the command prompt

If you are adventurous, you can follow the steps below to play around with the text color or modify the background of the CMD:

  1. Right-click on the title bar
  2. Select the ‘Properties’ option
  3. In the Window that appears, click on the colors tab
  4. You can now choose the preferred color for screen text and background as well. Additionally, you can change transparency of your CMD window.
  5. If satisfied with your options, click ‘OK

5. Create a Wi-Fi hotspot

This may come as a surprise to many, but it’s possible. You can easily create a Wi-Fi hotspot right from your Windows PC on the command prompt and share your Internet connection with other devices.

To accomplish this, follow the steps below:

  • Launch the command prompt
  • Run the command netsh wlan set hostednetwork mode=allow ssid=HotspotName key=Password“. Replace “HotspotName” with your preferred Wi-Fi hotspot name and “Password” with the SSID password or password of the Wi-Fi hotspot.
  • Next, type “netsh wlan start hostednetwork” and hit ‘Enter’. Thereafter, your Wi-Fi hotspot will be broadcasted, and other devices will be able to connect to it.
  • To stop broadcasting your Wi-Fi hotspot, simply type and run netsh wlan stop hostednetwork

6. Generate battery health report

You can generate your battery’s health report by following the steps below:

  • Launch the command prompt as an Administrator; such that the prompt changes to: C:\Windows\System32
  • Run the command powercfg/energy
  • Windows will take 60 seconds to analyze and then generate a report in HTML format that is located in C:\Windows\System32\energy-report.html

7. Display a list of your computer’s drivers

To list your PC’s drivers, simply run the command driverquery:

8. Scan and repair files

If your Windows 10 PC is a bit sluggish and behaves in a weird manner, you might consider scanning and repairing files to rectify the situation.

To accomplish this, simply run the command below:

sfc /scannow

This will take some time, depending on your computer’s speed.

9. Get information on a command’s usage

If you are unsure about a certain command or you want to learn more about a command you have been using and the options available, use the syntax below:

Command /?

For example, to find out more about the ipconfig command, run:

ipconfig /?

10. Execute one command after another

To execute one command after the other, use the && operator between the two commands, as shown below:

command1 && command2

For example:

ipconfig && ping google.com

Then, sit back, relax, and wait for the commands to finish running!

Conclusion

With the above tricks, getting some extra tasks accomplished becomes easier using the command prompt tool.

Is there another CMD trick we might have left out?

Please share in the comment section below.

Are you sure your data on Windows Servers is secure?

Protect yourself and your clients against security leaks and get your free trial of the easiest and fastest NTFS Permission Reporter now!



How to Use the NTFS Compression Feature on Windows 10

Imagine using a machine that never gets full because you know how to bypass or free up more space to hold more data.

The NTFS compression feature can help you to manage the straightforward task of making your files smaller on storage media.

The Windows 10 operating system, with its New Technology File System (NTFS) technology, has an added compression feature that helps users to save on space while retaining normal access and without going through the manual decompression process.

Enabling NTFS compression could affect your machine’s performance negatively, especially if it has low computing power.

Whenever you access files, NTFS works on the background, decompressing and recompressing files.

Although compression reduces the performance of your machine, there are other setups that makes sense to use it. For example, it allows you to free up space even after deleting all temporary files and unnecessary contents.

Other administrators use it to store files that are not in use or to save files that have no significant impact on computer operations such as pictures and documents.

Regardless of your current operating environment, as long as you are using Windows 10, you can enable the compression feature using any of the following two ways:

  • Using compression at the file level
  • Using compression at the drive level

We are going to use this article as a guide to take you through the processes of enabling the NTFS compression using the two levels.

Using NTFS File Compression (File Level)

File level compression is the easiest to use in making files smaller without touching on the storage media or using additional tools such as zipping methods.

You can use the following steps to compress files and folders using NTFS:

  • Open File Explorer
  • Open the folder that will store the compressed files
  • Click on the Home button
  • Click the New folder button

TIP: Use the Ctrl + Shift + N shortcut to create a new folder

  • Give the New folder a name of your choice (in our case “Compression”) and press Enter
  • Right click on “Compression” and select the Properties option

  • Click on the General tab
  • Click on the Advanced button

  • Below the “Compress or Encrypt attributes” section, click to check the Compress contents to save disk space option

  • Click OK button
  • Click Apply button
  • In the “Confirm Attribute Changes” dialog box that follows, select Apply changes to this folder, subfolders, and files
  • Click the OK button

Once you have done all the steps above, NTFS file compression will be active, and any file sent to the folder will automatically undergo the compression process. The new changes in the folder will work on both files and folders.

By looking at the newly created folder, you will notice two arrows pointing to each other at the top right corner.

You can confirm the amount of space you are saving by right clicking on the folder and selecting the Properties option. Size indicates the original size before compression while Size on disk indicates the size of the folder after compression.

You can revert to the original folder properties using the same instructions but ensure you clear the Compress contents to save disk space option.

Using NTFS Drive Compression (Drive Level)

Alternatively, you can also use the option of shrinking folders and files individually by way of compressing the whole drive. This feature gives the same benefits as compressing individual files, meaning that accessing files will be much faster.

You can use the following steps on the hard drive to enable NTFS drive compression:

  • Open File Explorer
  • Click and select This PC
  • On the “Devices and drives section”, right click on the storages you wish to compress (in this case Data), then select the Properties option

  • Click on the Compress this drive to save disk space option

  • Click the Apply button
  • In the small “Confirm Attribute Changes” dialog window, select Apply Changes to Drive, subfolders, and files

  • Click OK button
  • Click OK button

Once you are here, know that the NTFS files will be active inside the drive. Compression can be active on a drive with or without files.

Note that compressing a drive with so many files will take a considerable amount of time; therefore, it is a good idea to compress an empty drive before storing files inside it.

To undo the changes above done at the drive level, use the same instruction as outlined but do not check the Compress this drive to save disk space option.

Knowing the Right Time to Compress Files Using NTFS

The compression ability of Windows 10 without the help of third-party software is useful when dealing with media storage issues.

However, before engaging the NTFS compression feature, here are the things you need to look at:

  • Activating compression on a drive running Windows 10 is not a bad idea; however, doing so may bring some negative consequences, such as poor system performance issues.
  • Before compressing the drive on the system, consider using Compact OS, which is an inbuilt feature that reduces installation footprints, giving up free space on the system drive.
  • Compression is applicable on virtually any device; for example, you can activate the feature on systems running on new processors and fast drives such as the Solid State Drive (SSD) for optimal performance. SD cards and USB flash drives can also use NTFS compression, but your focus should always be on more capable system drives such as the SSD and Hard disks.
  • If you are using a low-end or an old device, you can forgo the compression option and buy a larger external drive. External drives also play an important role in freeing up resources, without necessarily compressing and decompressing data that could slow down your system.
  • The amount of space you save using this feature depends on the amount of data and other factors. NTFS compression is ideally a fast and a quick process, but gives a small compression ratio compared to what third party tools offer.
  • Drivers and folders that use the NTFS compression can take in compressed files such as zip files and music files. Files that are already in compression state do not change in size.
  • When using NTFS compression, files go through a decompression process before moving over the network, meaning no optimization takes place to reduce bandwidth or time. So, instead of sending a large amount of data over a network through compression, try the zip container.
  • All the above steps also apply to the earlier version of Windows, such as Windows 8.1 and Windows 7.

Shortcode

Protect yourself! Discover all security holes in the folder hierarchy on your Windows fileservers!

Get your free trial of the easiest and fastest NTFS Permission Reporter now!

A Simple Way to Create and Hide a Junction Link on Windows 10

In the Windows Operating system, there are three types of links:

  • Hard links
  • Junction links
  • Symbolic links

A hard link creates a second directory entry to a file such that it can reference a file using more than one reference path.

A symbolic link creates a new file altogether that references an already existing file.

A junction link, also referred to as a soft link, is used in linking directories which are located on different volumes or drives, but not between network drives. It’s created only between two folders and not files.

In this article, you will learn how you can create and hide junction links.

How to create a junction link on Windows 10

To create a junction, you first need to define the location of the junction link as well as the folder you’d want to link it to. Take note that the target folder should exist before creating the junction link.

In this tutorial, we will create a junction link at:

C:\Users\james\OneDrive\Music with the target defined at E:\MTBL

To begin with, you need to run the Command Prompt tool as an Administrator.

You can achieve this by clicking on the Start button, typing cmd in the text field, right clicking on the Command Prompt option, and selecting ‘Run as Administrator’.

Next, let’s apply the mklink command as shown in the syntax below:

mklink /J “path to junction link” “path to target folder”

In our case, the command will be as follows:

mklink /J “C:\Users\james\OneDrive\Music\MTBL” “E:\MTBL”

You can verify the existence of the junction link using the dir command as shown below:

How to hide a junction link on Windows 10

Additionally, you can create a directory junction with the ::$INDEX_ALLOCATION attribute, which will create a directory with dots like this […].

Here is an example:

In this case, the target folder, E:\MTBL, is not displayed as highlighted. This shows that we have tactfully managed to “hide” it.

To navigate into the directory, you can use the syntax below:

cd …/…/

To ensure that it contains the same files as the target folder, you can use the dir command:

Here is a simple tutorial for creating and hiding junction links on the Windows 10 operating systems.

As you can see above, we have successfully managed to hide the path to the target directory using the […] notation.

Bravo!

Protect yourself and your clients against security leaks and get your free trial of the easiest and fastest NTFS Permission Reporter now!

Windows Filesystem: How to Hide the Destination of a Directory Junction

Directory junctions are critical NTFS features on Windows that hide security vulnerabilities from would-be attackers. Junctions can help in creating symbolic links using normal privileges.

The best vulnerability that can exploit directory junctions is the AVGater, which works by abusing the ability of users to restore dangerous files that antivirus products have quarantined.

For example, the vulnerability can take place when a file is placed inside a folder X, and the antivirus solution marks the file as a virus, and moves it to the quarantine folder.

Thereafter, if the previously quarantined file is restored, the attacker can trick it into an arbitrary directory, which is not its original location.

The attacker can transfer the quarantined file to a hidden location on the host system, leading to abuse of the SYSTEM permissions and causing extensive damages.

Directory junctions can be misused if the target has time-of-check to time-of-use (TOCTOU) vulnerabilities.

You can also create a directory junction using the mklink utility, alongside the /J argument. It will now be possible to combine this with the ::$INDEX_ALLOCATION trick to create a directory junction with the name “…”

As you can see on the example above, the first directory was created using the normal name, which explains why destination is correctly shown in the dir output.

In the second junction, the target is absent and shown as […]. You can have your first junction to point to the second one, which also points to the third junction—until the last one points to the actual destination.

The paths are obviously confused; you can enter the junction using cd …\…\ that must be inside the System 32 folder. Remember the directory will point to C:\Test\

With the dir command, you can output files found on the System32 folder. The first command above created the Hello.bat file in C:\Test\

From the screenshot above, the Hello.bat command is shown to come from the current directory (.\). It will execute to its content, not what is contained in the C:\Windows\System32\hello.bat.

Since you can set up folders in any way, this can be applied to bypass application whitelisting programs using white scripted files.

This way, hiding the destination of a directory junction becomes possible.

Do you want to prevent unauthorized deletion of directory objects or something similar to this problem?

Protect yourself and your clients against security leaks and get your free trial of the easiest and fastest NTFS Permission Reporter now!