Skip to main content

Posts

Showing posts with the label Windows Server

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...

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 check device uptime since last reboot

Checking how long the machine or server is running since last reboot or maintenance is sometimes necessary. To measure the device performance or stability of the server or computer. In Windows, PowerShell is quite handy to to check the uptime of the server. Here's a simple code snippet to do check how long the server has been running since its last reboot. $Last_reboot_time = Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}} $Today = Get-Date $uptime = NEW-TIMESPAN –Start $Last_reboot_time.LastBootUpTime –End $Today $xdays=$uptime.Days $xhours=$uptime.TotalHours $xhours=[math]::Round($xhours,2) write-output ("Computer is up since last reboot for: $xdays day/s and  $xhours  hours") Sample output of the code below: Computer is up since last reboot for: 1 day/s and  45.98  hours Cheers! Take care. Till next Time. Stay safe! and Keep things up!  Do ASAP,  A lways  S ay  ...

PowerShell test/check if file exist

One liner code to check if file exists via PowerShell. Code below will check if Winrar.exe exist on the path specified. if (-not (test-path "$env:C:\Program Files\WinRAR\winrar.exe")) {write-host "File not found"; break;} {write-host "File Found" } Output will show "File Found" if winrar.exe exists on the path specified. The "break;" command on the code will cause the script to exit and not to continue to show "File Found" if the file doesn't exist. Or else it will be confusing to see the output. However, if the file can be found then the "File not Found" will not be shown. PowerShell will automatically bypass the first command on the { } curly braces and execute whatever is on the next line. Code below will check if output.txt exist on c:\temp. if (-not (test-path "$env:C:\temp\output.txt")) {write-host "File not found"; break;} {write-host "File Found" } Output ...

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...

Close all open notepad instances or processes in one go

If you’re an admin and manually checking logs for details and opening each file one by one. Then opening multiple instances of notepad is quite an everyday task. Or you just love notepad in making notes, documentations or other endless reasons to use notepad. Then it will be a headache in closing all the notepad instances that were opened. However, PowerShell can be used to close all instances of notepad all at once. No sweat in clicking each file one by one. PowerShell can handle it in one click of a button if you open the file via PowerShell ISE. Here’s a simple PowerShell code snippet to close all files in one shot. #========== $x = ( Get-Process | Where-Object   { $_ . ProcessName -EQ 'Notepad' }) . count   1 .. $x | % {    stop-process -name notepad –force } #=========== Yes, 2 lines of code can save you a lot of time. The above code can be used also to close other processes that has multiple instances open on the system. If uns...

How to disable Firefox Auto-Update

Not installing any updates is not a good idea at all. Since the software/device will be vulnerable for any security issues. However, disabling update and installing it later is another story. Of course, updates should be installed as promptly as possible especially if it is a critical update. Mozilla Firefox has an auto-update feature, this feature though is customizable you can disable auto-update and enable later if you need to install updates. How to disable and enable auto-update in Mozilla Firefox? For Windows OS 64 bit, open an elevated command prompt. Elevated command prompt or admin command prompt is needed when modifying features that requires admin access. At the elevated command prompt, browse or change directory to where Mozilla is installed. Default location would  be: C:\Program Files\Mozilla Firefox Search for mozilla.cfg, and open it with your preferred text editor. Or simply type: notepad mozilla.cfg this will open the config file. Depending on what has been set in...

Difference between incremental and differential backup

Differential or Incremental backup are part of the options that need to be selected when installing a backup software. Or the system admin has to choose which backup strategy he or she will adapt. Backup is very important so you have something to rely on when disaster strikes. So, what’s the difference between differential and incremental backup? Which one is better? Differential backup – contains  the files that have changed since the last full backup. So, if the full backup was Sunday, Monday will have files that changed since  Sunday  backup. For the differential backup of Tuesday, it will contain the files of Monday and the files of Tuesday. Differential backup = requires large space since every differential backup has the files that had changed since the last full backup Incremental backup – backup only the changed data since the last backup. So, if the Full backup was done on Sunday; Monday backup will only have the data that has changed since last Sunday ...

Check Windows Task Scheduler Status and Last Run Time

Task Scheduler is an awesome tool that every Sys Admin should be familiar with it. Task Scheduler in a way can help automate task, if the task is repetitive or a task that has to be done at a certain date and time, or a task has to be done once a week, once a month or even once a year. Task Scheduler is the best tool for this scenario. In this busy world of digital technology, who can keep remembering that a task must be done on a specific date and time. Yes, it might works once but as time goes on and task or jobs of a Sys Admin keep filing up chances are the task might be forgotten and the person-in-charge might just remember the things that needs to be done if there is an issue that happens already. So, Task Scheduler is a tool in which you test once, set if tested okay and forget about it. Test to make sure that the task to be set, works properly and just forgot about it; it will do the task repetitively albeit depends on the settings that was set. Of course, Task Scheduler...

Monitor disk drive space using PowerShell

Monitoring space is quite crucial in a critical system, or basically checking the disk space whether there is enough free space for continual operation is a good thing to consider in a production environment. A simple PowerShell script can save the day by monitoring the drive space of a specific drive that needs to be checked or monitored. It doesn’t need a complex tool to do this kind of task. Here’s a one-liner PowerShell script to check free space on C drive. Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'c:' " | Select-Object   { $_ . FreeSpace / 1GB }   "DeviceID = 'c:' " = this can be changed to any drive letter Output of the above command: $_.FreeSpace /1GB -----------------   293.042289733887   Or to include the existing size of the drive, the command can be tweaked like this: Get-WmiObject Win32_LogicalDisk -filter "DeviceID = 'c:' " | Select-Object   { $_ . FreeSpace / 1GB } , { $...

Read or get the list of contents on S3 bucket

S3 or Simple Storage Service bucket is quite handy to store files or any data on AWS cloud. As with any storage, online or offline organizing the data is quite an issue. When there are a lot of files of data on the storage; finding the data that you will need will be difficult. Especially, if the data or bucket is not organized properly. And even if the data has been organized by folders with proper time stamp but no specific data catalog to classify which one is which one it is quite a challenge to find or get the data on time. S3 is ideal for backup, since backup is often accessed only when it is needed. So, familiarization of the backup folder structure is necessary. In order to find or get easily the data, listing the contents of the S3 bucket is a good option when unable to find the files or data needed. Once the list is ready, opening the list via editor such as notepad and searching or finding thru the editor will provide an option to find things quickly and easily. ...