←July→
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
|
|
|
|
|
Sun, Jun 30, 2024 9:12 pm
Determining the version of a PDF document
If you have a Portable Document
Format (PDF) file and wish to determine the version of the PDF standard
used for the document, that information is stored in the first line of the
file. You can open the file with a
text editor, such
as the Windows
Notepad application on a Microsoft Windows system and view
the first line to determine the PDF version used for the file.
You will see %PDF-x.y
where x.y is the
version of the PDF standard used in the creation of the file,
e.g., %PDF-1.7
for version 1.7.
On a Microsoft Windows system, you could also open a
PowerShell window (you can type PowerShell
in the Windows Search field and click on the
application when you see it returned in the list of
results) and use the Get-Content
cmdlet
and the -First
parameter followed by the number one.
E.g.:
PS C:\> Get-Content "July 2024 Newsletter.pdf" -First 1
%PDF-1.7
PS C:\>
Related:
-
PowerShell Get-Content equivalents to Linux head and tail commands
Date: March 22, 2024
[/os/windows/PowerShell]
permanent link
Fri, Jun 28, 2024 9:17 pm
Mirroring Disks with Windows Disk Management
I added two Western
Digital 10 TB hard disk drives to a Windows 11 system.
I wanted to have the second hard disk drive (HDD) mirror the first, which
is a
Redundant Array of Independent Disks 1 (RAID 1) configuration. You
can configure Windows to mirror the drives using the Disk Management utility
that comes with the Microsoft Windows operating system. To run the
utility, you can
open a command prompt with
administrator privileges and then type diskmgmt.msc
and hit Enter. You will then see a window showing all the drives
attached to the system. In this case, the new 10 TB drives are shown as
"unallocated", since they have not been partitioned and formatted yet.
[ More Info ]
[/os/windows]
permanent link
Sat, May 25, 2024 10:05 pm
Using MakeMKV for ripping DVDs and for other A/V tasks
If you wish to "rip" a DVD, i.e., create a video file on a disk drive
from the DVD, one free program you can use on Microsoft Windows systems
or Mac OS X systems is
MakeMKV.
The software can also be used to extract a video file from an ISO image of a
DVD.
[ More Info ]
[/os/windows/software/audio-video]
permanent link
Fri, May 17, 2024 3:10 pm
View RDP Firewall Rule using PowerShell
If a Microsoft Windows system is running the
Microsoft Defender
Firewall,
firewall software that comes with Microsoft Windows systems, you can
check on whether connectivity is allowed on a particular
network
port from a
command-line
interface (CLI) using
PowerShell. You can determine whether the Windows Firewall is active on a
system from a command prompt
using the command netsh advfirewall show
currentprofile
. If the value of "State" is "ON", then the Windows
Firewall is active on the system.
C:\>netsh advfirewall show currentprofile
Domain Profile Settings:
----------------------------------------------------------------------
State ON
Firewall Policy BlockInbound,AllowOutbound
LocalFirewallRules N/A (GPO-store only)
LocalConSecRules N/A (GPO-store only)
InboundUserNotification Enable
RemoteManagement Disable
UnicastResponseToMulticast Enable
Logging:
LogAllowedConnections Disable
LogDroppedConnections Disable
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
Ok.
C:\>
You can check on whether the firewall is permitting connectivity on a
particular network port, e.g., TCP port 3389 for the
Remote Desktop
Protocol (RDP), from a PowerShell prompt, which you can obtain by
typing powershell
in the Windows "Search" field at the bottom
of the screen and then clicking on Windows PowerShell when you see
it returned by the search function. At the PowerShell prompt, you can issue
the command Get-NetFirewallPortFilter | Where-Object { $_.LocalPort -eq
3389 } | Get-NetFirewallRule
. If you wished to check on whether
firewall connectivity is permitted for some other protocol, substitute
the port used by that protocol, e.g., port 22 for
Secure Shell (SSH)
connections.
[ More
Info ]
[/os/windows/software/security/firewall]
permanent link
Mon, May 06, 2024 10:31 pm
Stopping automatic updates to Microsoft Paint and other Microsoft Store apps
When I sat down at a system running the Microsoft Windows 11 operating
system on Saturday, I saw a message stating that
Microsoft Paint
had updated itself automatically. I had at least a dozen Paint windows open
where I had posted screenshots over the past week for things I wanted to
check later. I had not saved those Paint windows; I had anticipated going
through them on Saturday, extracting information I wanted to keep from some
images and then closing the windows and saving others. But I found
the update had just closed them all without any prompt asking whether
I wanted to save them and without saving the images. So I lost all the
information from them irretrievably. Certainly, I should have saved
the images in those Paint windows or used some other graphics application that
automatically saves the contents of windows for that application or at least
won't automatically update itself without saving any unsaved work, but I'm still
irritated at the mindset of Microsoft developers regarding not caring
about the impact to users if users have unsaved content in Microsoft
applications, in addition to being irked with myself for not saving
the information. I do use Paint a lot for simple graphics tasks, such as
cropping and resizing screenshots, and I don't want it updating itself
without warning when that may lead to a loss of information I haven't yet
saved. You can determine when a Microsoft Store app was last updated and turn
off automatic updates for apps obtained from the Microsoft Store, though
you have to turn off the auto update feature for all apps, since there is
not a way to do it only for a particular app, such as Paint.
[ More Info ]
[/os/windows/software/graphics/mspaint]
permanent link
Mon, Apr 15, 2024 9:01 pm
Calculating a hash value for a file with Get-FileHash
The PowerShell cmdlet
Get-FileHash provides a
cryptographic hash function that will allow you to determine a
hash value of a file on a Microsoft Windows system. By default,
the cmdlet
uses the SHA-256 hash
function, but you can specify other functions, such as
MD5, using the
-Algorithm
parameter. You can change the output to a list
format by
piping the output
of the cmdlet to Format-List
.
PS C:\users\public\downloads> Get-FileHash ".\rel_x64_Xming-7-7-1-1-setup.exe"
Algorithm Hash Path
--------- ---- ----
SHA256 B7B4C0A191E315686A2481DCC8BBB27D6D7A156FBF689768E48CF08207B86560 C:\users\public\downloads\rel...
PS C:\users\public\downloads> Get-FileHash ".\rel_x64_Xming-7-7-1-1-setup.exe" | Format-List
Algorithm : SHA256
Hash : B7B4C0A191E315686A2481DCC8BBB27D6D7A156FBF689768E48CF08207B86560
Path : C:\users\public\downloads\rel_x64_Xming-7-7-1-1-setup.exe
PS C:\users\public\downloads> Get-FileHash -Algorithm MD5 ".\rel_x64_Xming-7-7-1-1-setup.exe"
Algorithm Hash Path
--------- ---- ----
MD5 BA200636A596A84E0877901CE89D1C2E C:\users\public\downloads\rel...
PS C:\users\public\downloads>
[ More Info ]
[/os/windows/PowerShell]
permanent link
Mon, Apr 01, 2024 10:10 pm
Determining the default gateway and subnet mask from a Windows command prompt
From a command prompt on a
Microsoft Windows system, you can obtain details on the network configuration
by issuing the command ipconfig
or ipconfig /all
, if
you wish to see more details. If you are only interested in a specific value or
values, though, you can
pipe the output
of the command to the findstr
command. If you wish to see multiple values, e.g., the subnet mask and the
default gateway address, you can put text associated with both values,
separated by a space, within double quotes. Findstr will treat the space
between strings as instructing it to perform a
logical OR
operation, i.e., it will find any lines that contain either of the strings.
Findstr uses a case sensitive search, so you need to either match the case of
the text or use the /i
option with findstr, which instructs it to
ignore the case of text and perform a case insensitive search.
C:\>ipconfig | findstr "Mask Gateway"
Subnet Mask . . . . . . . . . . . : 255.255.255.224
Default Gateway . . . . . . . . . : 192.168.1.1
C:\>ipconfig | findstr "mask gateway"
C:\>ipconfig /all | findstr /i "mask gateway"
Subnet Mask . . . . . . . . . . . : 255.255.255.224
Default Gateway . . . . . . . . . : 192.168.1.1
C:\>
You can also use a
Windows Management Instrumentation Command-line (WMIC) command to obtain
the same information.
C:\>wmic nicconfig get defaultIPGateway, IPSubnet
DefaultIPGateway IPSubnet
{"192.168.1.1"} {"255.255.255.224", "64"}
C:\>
[/os/windows/commands]
permanent link
Sun, Mar 31, 2024 8:11 pm
Configuring PuTTY for X forwarding
The
X Window System,
aka X11 or simply X, provides a mechanism that allows you to have the
graphical
user interface (GUI) for an application running on a remote system to
be displayed on the system on which you are running X server software. For
systems running a Microsoft Windows operating system, you can use the
free
PuTTY program to
establish a
Secure Shell (SSH)
connection to an
SSH server
and configure PuTTY to allow X forwarding so that you can run programs on the
SSH server, but have their GUI displayed on the Microsoft Windows system on
which you are running PuTTY.
[ More Info ]
[/os/windows/network/ssh/putty]
permanent link
Fri, Mar 22, 2024 9:44 pm
PowerShell Get-Content equivalents to Linux head and tail commands
The Windows
PowerShell
Get-Content
cmdlet can provide the equivalent to the Unix/Linux
head and
tail commands.
E.g., suppose a file named
somefile.txt
contains the following
ten lines:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
The following Get-Content commands could be used to obtain the first 5
and the last 5 lines in the file.
PS C:\Users\Arnold\Documents> Get-Content somefile.txt -Head 5
line 1
line 2
line 3
line 4
line 5
PS C:\Users\Arnold\Documents> Get-Content somefile.txt -Tail 5
line 6
line 7
line 8
line 9
line 10
PS C:\Users\Arnold\Documents> Get-Content somefile.txt -TotalCount 5
line 1
line 2
line 3
line 4
line 5
C:\Users\Arnold\Documents>
The TotalCount
parameter can function like the
Head
parameter and will return the first x number of
lines specified with x being 5 in the example above. You can also
use it to obtain a specific line, though. E.g., if you wished to see the
7th line in the file, you could use the command below.
PS C:\Users\Arnold\Documents> (Get-Content Somefile.txt -TotalCount 7)[-1]
line 7
PS C:\Users\Arnold\Documents>
By default the delimiter for lines is the
newline, aka end-of-line
character, \n
, but you can change that with the -Delimiter
parameter.
References:
-
Get-Content
Microsoft Learn
[/os/windows/PowerShell]
permanent link
Thu, Mar 21, 2024 9:06 pm
Determining Excel's autosave value from the Windows registry
Microsoft Excel provides an autorecover feature that allows you to recover
updates to spreadsheets or other files that were open in Excel even if changes
were made since the last time the file was saved. Excel will automatically save
files at a specified time interval so that if Excel crashes or the system
crashes or loses power, you can recover the latest version of the file, or at
least the file as it was the last time Excel automatically saved it. For the
Office 365 version of
Excel, you can find the autosave interval by clicking on
File in
Excel then selecting
More, then
Options, and then
Save. The default value is 10 minutes but you can have
Excel save more or less frequently.
You can also find the value by checking the
Windows Registry,
which you can view or edit by using the Registry Editor program that
comes with Microsoft Windows. You can find the value by navigating to
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options
and checking the value for AutoRecoverTime.
[ More Info ]
[/os/windows/registry]
permanent link
Privacy Policy
Contact