I want to use the vlookup excel function within powershell and without data manipulation of the CSV itself. So I wrote a script to import a CSV, find some data and compare these data
$CSV = Import-Csv -Path C:\Users\user\some.csv
$trigger = $CSV| Where-Object {$_."Primary Description" -like "some string with a computername"}
$result = $CSV| Where-Object {$_."Primary Description" -like "another string with a computername"}
$triggerComputer = foreach ($i in $trigger) {($i."Primary Description" -split " ")[5]}
$resultComputer = foreach ($i in $result) {($i."Primary Description" -split " ")[5]}
Compare-Object $triggerComputer $resultComputer
Windows cannot install package Microsoft.DesktopAppInstaller_1.19.10173.0_x64__8wekyb3d8bbwe because this package depends on a framework that could not be found. Provide the framework “Microsoft.UI.Xaml.2.7” published by “CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US”, with neutral or x64 processor architecture and minimum version 7.2109.13004.0, along with this package to install. The frameworks with name “Microsoft.UI.Xaml.2.7” currently installed are: {}
The reason is that you miss the dependency Microsoft.UI.Xaml.2.7
You may also get this error when you try to install winget
Windows cannot install package Microsoft.DesktopAppInstaller_1.19.10173.0_x64__8wekyb3d8bbwe because this package depen ds on a framework that could not be found. Provide the framework “Microsoft.VCLibs.140.00.UWPDesktop” published by “CN= Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US”, with neutral or x64 processor architect ure and minimum version 14.0.30704.0, along with this package to install. The frameworks with name “Microsoft.VCLibs.14 0.00.UWPDesktop” currently installed
OpenSSH is a free and open-source software that allows secure communication between computers over an unsecured network. It is widely used on Linux and Unix systems, but it is also available for Windows systems. In this article, we will show you how to install and configure OpenSSH on a Windows 2022 server.
Step 1: Install OpenSSH
The first step is to install OpenSSH on your Windows server. To do this, follow these steps:
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start the sshd service
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
Step 2: Configure OpenSSH
Once OpenSSH is installed on your server, you need to configure it to allow secure communication. Follow these steps to configure OpenSSH:
Open notepad
Open the configuration file C:\ProgramData\ssh\sshd_config
Remove the “#” at the beginning of the line #PubkeyAuthentication yes to uncomment it:PubkeyAuthentication yes
Locate the line that starts with #PasswordAuthentication yes and remove the “#” at the beginning of the line to uncomment it and change it to NO: PasswordAuthentication no
Add the “#” at the beginning of the line AuthorizedKeysFile PROGRAMDATA/ssh/administrators_authorized_keys to comment it out:#AuthorizedKeysFile PROGRAMDATA/ssh/administrators_authorized_keys
Save the changes and close the configuration file.
Restart the service
# Restart the sshd service
Restart-Service sshd
Step 3: Configure the Administrator for key-based authentication
After the configuration is complete, you need to configure the public key.
Optional: If you don’t have a public/private keypair use this command to create the files on your client:
ssh-keygen -t rsa -b 4096
Open the Explorer and go to C:\Users\<Username>\
Create a folder .ssh
Create a text file (without extension!) authorized_keys
Open the file in notepad
Paste your ssh-rsa public key in this authorized_keys file (this is the content of id_rsa.pub)
Save the file
Remove the inheritance so that only the user and system has full permission
Step 4: Test OpenSSH
To test if OpenSSH is installed and configured correctly, follow these steps:
Open a Command Prompt window.
Type “ssh username@<server>” and press Enter.
If the connection is successful, you should see a welcome message.
Congratulations! You have successfully installed and configured OpenSSH on your Windows 2022 server and configure it securely with key-based authentication.
Optional: change CMD to Powershell
If you want to connect directly in PowerShell instead of the default command use this PowerShell command
Are you in a situation where you need to capture and analyze network traffic, but don’t have Wireshark or TCPDump at your disposal? Don’t worry, there’s still a solution. Enter pktmon.
While it may not be the most sophisticated tool out there, pktmon is a viable option for monitoring traffic in real-time. With its lightweight and efficient design, you can quickly capture and analyze packets without the need for any additional software installations.
So, how exactly does pktmon work? It uses the Windows Filtering Platform (WFP) to capture network traffic at the packet level. This allows you to examine specific details about each packet, such as its source and destination address, protocol, and payload.
But what makes pktmon really stand out is its ability to filter traffic based on specific criteria. For example, you can use it to only capture traffic from a specific IP address, port, or protocol. This makes it a powerful tool for troubleshooting network issues or identifying potential security threats.
While pktmon may not be the most robust traffic monitoring tool out there, it’s certainly a valuable option to have in your arsenal and its already installed π So the next time you find yourself in need of capturing and analyzing network traffic, give pktmon a try – you might just be surprised by what it can do.
#start the traffic capture
pktmon start -c
#stop the traffic capture
pktmon stop
#convert the file so you can view it in notepad
pktmon etl2txt <etl file>
Nvidia is always a pain in the ass on Linux. Especially with a old white 2008 macbook. I have black screen issues every time so I create this article so I can easy find it when I reinstall this laptop π
First find the right identifiers.
We need both the IDs for the graphics card and the PCI-E bridge that it is connected to. Issue the following command in a shell:
Have a look at (1) the line saying display and (2) the line with bridge right before that display line. Write down the PCI-E bus ids (format XX:YY.Z) of the bridge device (here 00:17.0) and the display device (here 04:00.0) and remember which is which. Note: Those IDs may be different on your machine, depending on your Mac model and revision.
Create a GRUB script for setting the PCI-E registers during boot
Fire up a text editor with sudo nano /etc/grub.d/01_enable_vga.conf and copy/paste the content below. Make sure to paste all 4 lines into that file! Replace00:17.0 with the PCI-E ID of your bridge device noted in step 1. Replace04:00.0 with the PCI-E ID of your display device noted in step 1.
To automate some tasks with PowerShell on a website you sometimes need to log in. Today I tried some curl and postman tricks but it isnβt hard if you know what to script with PowerShell and bypass all other tools.
First, find a website to log in to, then check the page source and what the submit button does. In this example, it is βInloggenβ (dutch for login).
Then start the developer tools (F12), select the network tab, enter the credentials and login.
Now check the POST request in the developer tools.