IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Delay Shutdown or Restart on a Windows Server

One client had a windows server with a memory leak problem that needed further investigation. While the application was still being checked, the production server had to be rebooted at least once a week.

What struck me was that they really assigned an FTE to log in after midnight to reboot the server manually. And this is really unnecessary.

While I understand that a highly critical system may need close supervision, most activities such as this can be done automatically using the shutdown.exe command tool. This tool is available on all Windows OS (server or desktop) and very handy for a super simple task like the case above. If needed, you can even do a more fancy automation with a script.

Nobody should do an extra work at odd hours just to reboot a server. You can always execute the shutdown command in advance by using a time-delay option.

For a server reboot with a time-delay, use the following command in Command Prompt window or Windows PowerShell:

PS H:\> shutdown /r /f /t 21600

/r – Restarts the computer after shutdown.

/f – Forces running applications to close without warning users.
Caution: Using the /f option might result in loss of unsaved data.

/t – Sets the time-out period before shutdown to xxx seconds.

In this example, the time is set to 21,600 seconds (or 6 hours).

Windows shutdown command tool - restart with parameters and confirmation

Pay attention that you get a confirmation window to check when the system will be rebooted (bottom right corner).

If you make a mistake or just want to change your mind on the parameters, you can always cancel your job by using /a parameter (abort). This only works when you use the time-delay. Otherwise the shutdown is instantly executed.

PS H:\> shutdown /a

Then you can execute a new shutdown command with the new parameters.

For more available options, you can run shutdown with a /? flag or check the link at the end of this post.

Important: If you want to really shut down a computer or server, you need to use /s parameter (instead of /r), but only use it to a local workstation or server that you can access. I personally never use this flag for any remote systems.

It’s also worth repeating from the remarks, that the user id you use to execute this command has to have the proper access level:

  • Users must be assigned the Shut down the system user right to shut down a local or remotely administered computer that is using the shutdown command.
  • Users must be members of the Administrators group to annotate an unexpected shutdown of a local or remotely administered computer. If the target computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. For more information, see:
    • Default local groups
    • Default groups

Yes, there is a situation that warrants a manual reboot when there are sensitive interconnecting processes involved, but for a simple server reboot, there’s always a smarter and more practical way to do it and we should try to utilize any tools provided to make life simpler and minimize burn out.

Further Reading

Windows Server: shutdown
How to Delay Shutdown or Restart on a Mac

January 6, 2023 Filed Under: How To Tagged With: Windows, Windows Server

How to Type Emoji Using Keyboard Shortcuts in Windows and macOS

One thing that you can do easily in a smartphone but not so obvious in a desktop computer is to quickly type an emoji character in your text. By memorizing these keyboard shortcuts, you can do the same, whether it’s on a Mac or a Windows system.

Mac

On a mac, press all these keys: ⌃ CTRL + ⌘ Command + spacebar.

Emoji keyboard shortcut demo for macOS

Windows

Either of these combinations will work on Windows 10 or later:

  1. Windows + . (Period)
  2. Windows + ; (Semicolon)

Emoji keyboard shortcut demo for Windows

That’s all there is to it.

Notice that the emoji will be rendered a bit differently for each OS, but that should not be a problem.

Once you know this trick, soon enough you’ll be more tempted to using it more in your notes or blog. 🍻

Further Reading

Mac keyboard shortcuts

January 5, 2023 Filed Under: How To Tagged With: macOS, Windows

How to Search for IPv4 Addresses with RegEx in Visual Studio Code

This is a basic instruction on how to search for any texts that resembles IP addresses in all files within a folder using Visual Studio Code.

Although it’s not going to be a perfect solution, we’re going to use Regex to do the search. And we’re going to want to get all invalid IPs as well, so it’s not 100% precise. Here, we want to error on the side of getting a bit too much rather than too little.

Steps

  1. Launch Visual Studio Code and open the folder where you want to search the files with IP addresses.

    Visual Studio Code - Open Folder

  2. We want to search for all files within this folder, so using a keyboard shortcut, press CTRL+SHIFT+F for PC or CMD+SHIFT+F for Mac.

    We’re going to use the following pattern:

    ((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}
    

    IMPORTANT: This is very easy to miss. Make sure the Use Regular Expression icon is active, otherwise the RegEx search will not work.

    Visual Studio Code search using Regular Expression active

  3. You’ll see all the files that contain anything that looks like IP addresses are listed underneath the search box on the left pane and you can click on each file to see where the IP addresses are found.

    Visual Studio Code Regex IP4 search

For various REGEX patterns to use to fine tune your search, just check out the link below for a more thorough explanations/discussions.

Further Reading

Validating IPv4 addresses with regexp
How to Use RegEx to Replace Text in JavaScript

January 4, 2023 Filed Under: How To Tagged With: Visual Studio Code

How to Open VSCodium from command line macOS

This is way easier than Visual Studio Code.

If you installed VSCodium using Homebrew, it will work right away. The only difference is the name of it.

It’s actually easy to remember. For both VSCode and VSCodium, the command line is the name without the “VS.” So instead of code in Visual Studio Code, it’s codium for VSCodium.

So in Terminal, you can type in the following:

% codium .

And VSCodium will open up and load all the contents in that folder where you type in that codium . command.

Further Reading

VSCodium, a Free Version of Visual Studio Code
How to Open Visual Studio Code from command line macOS

December 16, 2022 Filed Under: How To Tagged With: Code Editor, Visual Studio Code

VSCodium, a Free Version of Visual Studio Code

Another code editor, very similar to Visual Studio Code. In fact, it’s the same build from Microsoft’s vscode repository without the Telemetry. For all intents and purposes, VSCodium looks almost identical to VS Code as you can see from the screenshot below:

VS Code (left) vs. VSCodium (right)

VS Code (left) vs. VSCodium (right)

So what’s the difference between the two?

In short, VSCodium has much less Telemetry report sent to Microsoft. It is the “binary releases of VS Code without MS branding/telemetry/licensing.”

This repository contains build files to generate free release binaries of Microsoft’s VS Code. When we speak of “free software”, we’re talking about freedom, not price.

Microsoft’s releases of Visual Studio Code are licensed under this not-FLOSS license and contain telemetry/tracking. According to this comment from a Visual Studio Code maintainer:

When we [Microsoft] build Visual Studio Code, we do exactly this. We clone the vscode repository, we lay down a customized product.json that has Microsoft specific functionality (telemetry, gallery, logo, etc.), and then produce a build that we release under our license.

When you clone and build from the vscode repo, none of these endpoints are configured in the default product.json. Therefore, you generate a “clean” build, without the Microsoft customizations, which is by default licensed under the MIT license

Should I Use It?

It’s not a black and white thing but the good news is you can always use both and decide later.

The argument is VSCodium is more private, the opposite argument is without Telemetry, Microsoft wouldn’t be able to improve the product and make it available for free. Just make sure you understand the pros and cons of using each product.

How to Install

The easiest way for Mac installation is with Homebrew.

If you have Homebrew installed, just open Terminal and type the following:

brew install --cask vscodium

The benefit of installing using Homebrew is that unlike Visual Studio Code, opening vscodium from a command line works right from the get go.

For the other platforms, please read VSCodium: Download/Install

Further Reading

VSCodium
How to Open VSCodium from command line macOS
VSCodium: Why Does This Exist
VSCodium: Getting all the Telemetry Out

December 15, 2022 Filed Under: How To Tagged With: Code Editor, Visual Studio Code

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure