Skip to main content

Posts

Showing posts with the label Windows

Reading uncommented line in Linux and Windows

Reading uncommented line is almost a daily live for most Linux and Windows Sys Admin. Uncommented in .conf or .ini lines are the active or the lines that are currently in used for the loaded configuration. In Linux, it's quite straight forward to do it using grep. grep ^[^#] service_file.conf The above command uses regex, to search for lines in the .conf file that doesn't start with #. In regex ^ means the first character, but if it is inside the brackets it has other meaning. It negates whatever character that follows. So, the regex means search the first character that doesn't start with #. Technically, it's teling grep to search for uncommented lines. Yes, the above solution is for Linux. How can we do it in Windows? Well, it turns out to be almost the same but with a little twist of course since its a different operating system. So, here's how we can do it in Windows. findstr /b /v ^# file.txt Hopefully, it makes life easier and the above commands...

Windows CLI grant Full access to a folder

icacls is a command line utility tool that allows system admin to grant or deny access permissions to a folder or path. Example below grants the user "TheAdminUser1" to the Desktop path specified below. icacls C:\Users\admin\Desktop /grant TheAdminUser1:F To check whether the permissions has been applied or not. cd to the path, like C:\Users\admin\Desktop, then type: icacls . . >> means the current path Once everything is ok a similar output like the image below will be shown, and there should be an "F" access list which means Full Access Permissions. If the output shows "successfully processed 1 files" and failed processes shows "0" files then permission has been applied without any issues. For more complex scenarios, and if the system has PowerShell cmdlets installed like Get-Acl and Set-Acl might offer more flexibility. Cast all your anxieties on him, for he cares about you. - 1 Peter 5:7 Don't let your heart b...

Windows 10/11: "This PC" in Windows Explorer is not displaying or missing

In Windows 10/11 the "This PC" icon, previously known as "My Computer" during the era of Windows XP, may unexpectedly vanish when accessing Windows Explorer or File Explorer. Microsoft has included a feature that allows users to either display or hide the "This PC" icon within the Navigation Pane. To control the visibility of the "This PC" icon, users should open File or Windows Explorer, navigate to the "View" dropdown menu, select "Show," and then click on "Navigation Pane." By default, the "Navigation Pane" option is enabled. If this option is disabled, the "This PC" icon will not be visible in File or Windows Explorer. In summary, if the "Navigation Pane" is enabled, "This PC" will be accessible; conversely, if it is disabled, "This PC" will not be displayed. Please follow image below on how to do it. Open File Explorer or Windows Explorer by pressing ...

How to select single click or double click to open a folders in Windows

How to change settings in Windows to single or double click to open folders or items in Windows 11 or Windows 10? The default in Windows is you need to double click on opening folders or files. However, an option is given on the system to change it to single click. Images below shows how to change the settings to single click or double click when opening items or folders in Windows. Open Windows Explorer by pressing "Windows key + E" or simply right click the Windows icon the four squares on the task bar and choose "File Explorer". Once the "File Explorer" opens click or select the "3 dots ..." on the bread crumbs bar or whatever its called. Please see image below on which one to click. After clicking the "3 dots" select "options" from the drop down menu that will appear on the screen. Please see image below for the guide. After selecting or clicking the "options" button, a Window will appear where you ...

PowerShell to Verify BIOS Information

The BIOS Properties contain a wealth of information, with BIOS standing for Basic Input Output System. In technical point of view, a computer cannot start without the BIOS. While the computer may power on, it will only show a blank screen, and the operating system will not load or function or there will be no display. Here’s a straightforward PowerShell script to check details such as the BIOS release date, computer serial number, BIOS version, and additional information. PowerShell script to get BIOS information or data. $biosProperties = Get-WmiObject Win32_BIOS Write-Host "BIOS Name:" $biosProperties.Name Write-Host "BIOS Serial Num:" $biosProperties.serialnumber Write-Host "PrimaryBIOS:" $biosProperties.PrimaryBIOS Write-Host "BIOS ReleaseDate:" $biosProperties.ReleaseDate Write-Host "BIOS Version:" $biosProperties.BIOSVersion Write-Host "BIOS Caption:" $biosProperties.Caption Write-Host "BIOS Language...

PowerShell Get ComputerName

Getting computername in PowerShell is quite straight forward using environments variable. Example: $computerName = $env:ComputerName Write-Host "The computer name is: $computerName" With the right credentials and as long as WinRM or Windows Remote Management is enabled we can use the Environment ComputerName variable to shutdown a remote PC. This command runs or shutdown a remote pc, by invoking a local command to shutdown the PC. Invoke-Command -ComputerName remote_computer_name -ScriptBlock {Stop-Computer -ComputerName $env:ComputerName } The above invokes shutdown command locally, just like you were in front of the server or computer. Above is just a demonstration on how to use ComputerName environment variable. Shutting down a remote computer with a valid domain credentials, doesn't need the invoke-command instead command below can be used. Stop-Computer -ComputerName "RemotePC1", "Server2" -Force 1 Peter 5:6: "Humble y...

How to get assigned ESXi license on vCenter

There are few ways to get the assigned license to a host on vCenter, it could be done via ESXi Shell, PowerCLI, or via License Administration. However, it can be also done via Host Inventory option. Click "Inventory" option and select the host in which you want to check or verify on what is the License Key assigned to the particular host. After selecting or clicking the host, go to the "Configure" tab option. Click and expand the "System" drop down menu and click "licensing", then the license key details that has been assigned or applied to the host will be shown on the right pane on the same window. The "License" will be the name that was assigned to the License Key like, "License for Server1", or "Nginx Host License Key" it can be any name that was created by the administrator, descriptive name that can easily identify the server or host is much better. And the "License Key" is the details of ...

How to run a command after x minutes in Linux/Windows

In Linux command below will trigger an rm commands after 5 minutes. echo "sleep 5m && rm -f /var/www/html/products.html" | at now In Windows the command below will also trigger a copy command after 5 minutes. Start-Job -ScriptBlock { copy /html/update.html /shared/} -ArgumentList (New-TimeSpan -Minutes 5) Faith as big as a mustard seed will create a magnificient outcome in your life.

Windows delete recent items history

How to delete "recent windows items" or the links of the files you've open in Windows 10 or Windows 11? Here are the locations that will delete the windows recent items. Please test on a VM or any test device before applying to the actual computer or device. Make sure the output is what is expected. Open a command prompt and change directory to this locations: cd "%APPDATA%\Microsoft\Windows\Recent Items" cd %APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations cd %APPDATA%\Microsoft\Windows\Recent\CustomDestinations Yes, please test on a Virtual Machine before applying to a production laptop or computer. Cheers! Till next time. Do ASAP, Always Say A Prayer... Practice O.T.G. = Obedience To God Make time for Prayer and Meditation. Take time to kneel down and Pray! Practice F.IF.T.H (Firm In Faith Towards Heaven) Your attitude will depends your altitude, stay humble!

Check Time zone in Linux and windows machines

In Linux, open a terminal window and type the following command: timedatectl | grep "Time zone" In Windows, open a command promot and type the following command: tzutil /g To set a new timezone in Windows, open an elevated command prompt. Check out this link to set a new Time zone: https://quickbytesstuff.blogspot.com/2014/08/view-and-set-time-zone-via-command-line.html Checking Time Zone will clear up things, if the machine timing is properly sync or not. Or why machine is having a different time with the current location. Stay safe! and Keep things up! Another year is coming! Do ASAP,  A lways  S ay  A   P rayer ... Practice O.T.G. =  O bedience  T o  G od Make time for Prayer and Meditation. Take time to kneel down and Pray! Practice F.IF.T.H (Firm In Faith Towards Heaven)

Outlook keeps disconnecting and laptop no network or WiFi

Outlook is a very good tool, however if it gives some issues, it can ruin your day or your mood to work. Well, as the odds say nothing is perfect and even the flowers on the field that looks so beautiful will one day fade away. Same goes with our electronic devices, you just don’t know when it will go south. It might even give you issues when you needed it most to work properly, and sometimes that will be the time that it will not work as expected. Anyway, problems will always be there. The only question is, how will you face the issue or problem? For Outlook not responding and also the network or WiFi keeps disconnecting even though your phone or other devices or laptop has no issue to the network. It seems that the laptop has been singled out, and that’s the only device on the network that is not working. There are various approaches to solve this issue. Sometimes, it’s the same issue Outlook not responding or no network, but then different ways to resolve the problem. Yes,...

WMIC restart wireless network via command line in Windows

How to restart WiFi or Wireless using command line in Windows? If the wireless devices, laptops or computers are connected to a domain such as active directory, or a centralized control. The command below can be created using a batch file and deploy to all controlled devices or computers. The command below, has been tested on a Windows 11 laptop and works fine. If nothing goes wrong, the command executes very fast. Here's the command, must be executed on an elevated command prompt or administrator prompt. wmic service where caption="WLAN AutoConfig" call stopservice && timeout 3 && wmic service where caption="WLAN AutoConfig" call startservice Timeout command is used in between stop and start, as this would give the first command to stop the service and after 3 seconds, another command is executed to start the service. Without the timeout command, the second command might not run  properly, since the first is still executed on the background. Jus...

How to view windows folder in GB or MB or in human readable sizes

With the era of WSL, Windows Subsystem for Linux is quite helpful. You can now run Linux commands on Windows with ease, or without installing any virtualization software. Of course, having VirtualBox installed with Linux is a different story, since you can have a pure Linux environment. Anyway, WSL provides an easy way to view size or capacity of Windows folder without any scripting using PowerShell or installing any Sysinternal tools. How to view folder sizes in human readable format in Windows using WSL? If WSL has been installed and working correctly, open Windows Terminal an awesome command-line shell application, in which you can run multiple Windows in one screen. And you can also position different windows terminal, either horizontally or vertically and Terminals can be resized the way you wan it. Grab windows terminal from Microsoft Store and for the prize of free. Once the Windows Terminal is open, just cd or browse to the directory where you need to check folder sizes. Just p...

How to rip or convert old auido CDs to MP3 or digital format

Old habits are hard to break as they said, however, music of your generation old favorites music of yesteryears will always stay with you. Such music, are hard to forget since the mold your young life or even such songs inspired you to get through difficult times and be who you are today. Or just simply a music of wonderful memories with friends and love ones. Anyway, how to convert or rip CDs to digital format such MP3, WMA,  M4A or any other format that the converter supports. To convert CDs, a CD drive or reader is needed. A built-in CD drive or an external USB-Disk Drive that can read CDs or DVDs. In Windows 11 or Windows 10, these are the steps: Step 1: Insert the Audio CD to the drive Step 2: In the search are beside the windows logo, type: Media and from the search result choose or select the "Media Player". Step 3: In the top left hand side of the Media Player, you will see the Album of the insert CD, it will either show the album name, or if Media Player will not be ...

How to burn iso to CD or DVD in using Windows command line

Burning ISO is quite common especially if you need a bootable disc to install a software to a laptop, desktop or a server. So, how to burn an ISO image in Windows without a 3rd party software? The answer is yes it is possible. In a Window 10 or Windows 11, laptop or device a USB DVD/CD burner is needed. Of course, a blank DVD or CD is needed as well. How to burn an ISO image in a Windows command line? Open a windows command prompt, press Windows Key + R this will open run box and type "cmd" and press enter. Or simply, search for CMD on Windows menu and click on it. On Windows command prompt type: cd c:\windows\syswow64 on a 64 bit architecture machine. on c:\windows\syswow64 type the full path where the ISO can be found. Example: c:\windows\syswow64\isoburn  VMware-VMvisor-Installer-7.0U3g-20328353.x86_64.iso  So, the syntax is: isoburn path-to-the-iso-file  the burner will be automatically detected by the CLI. Sample image below of the ISOBurn. Once the ISO burn opens, t...

How to view save passwords on Microsoft Edge

Saving passwords in the browser is convenient. It will make your browsing smooth, and easy since every time you visit a site you don't need to fill-in or type your password. However, make sure that you are the only one using the computer or else if the computer is shared then everyone can use your password and they can access the websites in which your password is readily available to automatically fill-in every time the website is open on the browser. Yes, convenience and security sometimes doesn’t go together. It might be convenient to do, by saving password on the browser but you need to trade off security or if you don’t saved the password and you need to type every time your password, it might not be easy to do but it is more secured. And also saving password on the browser, would sometimes results to a forgotten password. So, if ever you browse the site in an incognito or private mode. Then you will need to type your password, or if you browse the site on another comput...

How to use hibernate in windows from command line?

Hibernate option in Windows is an option to shutdown any Windows laptop and after turning on again the laptop, all resources that was open before shutting down; such as word document, excel or other application are still available and running. The user doesn't need to re-open the applications. User  can continue where he or she has left off. Cool, feature! Using command line, the cli command shutdown.exe provides an option on how to shutdown a Windows machine to hibernate. The option I believe is available for all Windows edition even Server edition. Why do we need to use hibernate in Windows? Well, there are plenty of reasons. One example, if you have a few browser tabs open but then you need to shutdown the machine and don’t want to re-open all the browser tabs then hibernate is a good option. Or if you’re downloading something and you need to check whether download was completed, or just need to check whether there were some errors during the download operations then hibern...

Parallel Processing example using PowerShell

PowerShell version 7 has option to run tasks in Parallel.  This would mean that task that can be run in Parallel mode and tasks can be done simultaneously and save time.  How to get started or making use of Parallel in PowerShell?  First, PowerShell has to be in version 7.  Version 7 of PowerShell can be downloaded from Microsoft via this link below.  PowerShell 7 download. Choose the version, whether its x86 or x64.  The CPU architecture in your system will determine whether x64 PowerShell can be used or not.  Check out this link to check CPU architecture in your system:  Check if 64 bit processor or 32 bit Sample code below, shows how Parallel processing in PowerShell can be done.    $HostsIPs = '127.0.0.1','8.8.8.8','8.8.4.4','1.1.1.1'    $HostsIPs | ForEach-Object -Parallel {      Test-Connection $_      } -ThrottleLimit 5   The screenshot image below, shows that the commands indee...

Enable/Disable NICs from Windows command line

First thing to do is to get or list all NICs available on the system. This must be done by opening or running the command in an elevated command prompt. Check out links below on how to open an Elevated Command Prompt. https://quickbytesstuff.blogspot.com/2014/10/open-elevated-command-prompt.html https://quickbytesstuff.blogspot.com/2018/06/how-to-open-elevated-command-prompt.html Why need to open an elevated CMD? Some commands needs to be run by a person who understands what he or she is doing. Or simply, some commands are for Sys Admin or IT personnel who are tasked to control or manage the system. So, commands has to be run on a elevated cmd which has an admin privileges. Here's how to enable or disable NIC interfaces on a Windows system via CLI. First, open an Elevated CMD. Then need to list, show or get all the available NIC on the system. Get NIC list and index number: wmic nic get name, index Sample Output of the above command: C:\WINDOWS\system32...

Create a backup using Robocopy

Creating a backup is a must if not a necessity for a SysAdmin job. Backup doesn't need to be complex or needs a very powerful software to do a backup. At the end of the day, whether it's a good commercial software creating a backup; what it does in the background is create another copy of the file or folders that needs to be backed up. So, for that reason a simple copy command with the existing tool in Windows can do a job also for some simple backup like logs or other files. Why need to backup the logs? In a security perspective and audit purposes, logs are very important. Of course, it will also depend on the contents of the log whether it is quite detailed or important data is captured like username, IP Address, time, files and folder being accessed and other data. Problems or issues may not be detected in real-time or issues maybe notice at a later time but the action that cause the issue happened some time ago as well, in which the only witness are the logs. A simple batch...