pwsh script to check user password expiration on windows server

Import-Module ActiveDirectory
$users = Get-ADUser -Filter * -Properties PasswordExpired, PasswordLastSet
foreach ($user in $users) {
    $username = $user.Name
    $passwordExpired = $user.PasswordExpired
    if ($passwordExpired -eq $true) {
        Write-Host "$username: Password has expired"
    } else {
        $passwordLastSet = $user.PasswordLastSet
        $passwordAge = (Get-Date) - $passwordLastSet
        $passwordExpireDate = $passwordLastSet + (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge
        $timeUntilExpiry = $passwordExpireDate - (Get-Date)
        Write-Host "$username: Password expires in $timeUntilExpiry days"
} | Out-File -filepath "C:\temp\passwordExpiry.log"

Generate Github SSH key

Its old info but there is always someone who doesnt know how to do it. For library reasons, here it is:

Launch a terminal. If you are using Windows, launch Git Bash.

Type the following command in your terminal, replacing with the email address that is linked to your Github account. When you have typed the command, press Enter.

ssh-keygen -t rsa -b 4096 -C “”

A new SSH key is generated.

You will be prompted to enter a directory to save the key. You can simply press Enter to accept the default location, which is an .ssh folder in the home directory. This means you will be able to locate the key in ~/.ssh/id_rsa.

You will be prompted to choose a passphrase. You also have the option not to create a passphrase. To skip the passphrase, press Enter twice to confirm that the passphrase is empty.

Optional: To navigate to the .ssh directory, and check the contents of the directory, run the following commands in the terminal:

cd ~/.ssh

and then,


When you list the contents of the .ssh directory, you should see id_rsa and in the list of contents, where id_rsa is the private version of your key and is the public version of your key.

You now need to add the SSH key to the ssh-agent, which helps with the authentication process. To start the ssh-agent, run the following command in the terminal:

eval “$(ssh-agent -s)”

To add the key to the agent, run the following command in the terminal:

ssh-add ~/.ssh/id_rsa

Error 0x0000011b Windows 10 USB printing

To fix the recent 0x0000011b printing errors without removing the current Windows Updates (KB5005565), you can instead disable the CVE-2021-1678 mitigation enabled by default this month.

To do that, open the Windows Registry Editor and navigate to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print key, create a new DWORD-32 bit value named RpcAuthnLevelPrivacyEnabled, and set it to 0 and restart the PC.

Auto-logout users in linux systems (from:

Auto logout inactive users in Linux

There are three methods to do this…. I post form one. To get the rest methods please visit

We can auto logout inactive user sessions after certain time in three ways. Let us see the first method.

Method 1:

Edit ~/.bashrc or ~/.bash_profile file:

$ nano ~/.bashrc


$ nano ~/.bash_profile

Add the following line at the end:


Configure user time out value in Linux

This makes the user to logout automatically after an inactivity of 100 seconds. You can define this value as per your convenient. Press ESC and type :wq to save the file and close it.

Apply the changes by running the following command:

$ source ~/.bashrc


$ source ~/.bash_profile

Now, leave the session idle for 100 seconds. After an inactivity of 100 seconds, you will see the following message and the user will be automatically logged out from the session.

timed out waiting for input: auto-logout
Connection to closed.

Auto logout inactive users in Linux

This setting can be easily modified by the user. Because, ~/.bashrc file is owned by the user himself.

To modify or delete the timeout settings, simply delete the lines added above and apply the changes by running the following command:

$ source ~/.bashrc

Alternatively, the user can disable this by running the following commands:

$ export TMOUT=0


$ unset TMOUT

Since the timeout setting is stored in the user-owned ~/.bashrc file, s/he can easily bypass it by simply deleting the line. If you want to prevent the user from changing the settings, follow second method.

Linux terminal commands for background runs

Using nohup allows you to run a command in the background and keep it running. How? nohup bypasses the HUP signal (signal hang up), making it possible to run commands in the background even when the terminal is off. Combine this command with redirection to “/dev/null” (to prevent nohup from making a nohup.out file), and everything goes to the background with one command.

nohup COMMAND &>/dev/null &

If instead of closing the terminal you type disown the terminal windows will not include in its jobs the command you wrote above and therefore even when you close it, the command will still run.

Powershell’s equivelant .bashrc

To find the equivelant of .bashrc file that exists in Linux, type in powershell v7 the following command:

$PROFILE | Get-Member -Type NoteProperty | Format-List *

and it will show you all the locations for the various profile files depending on functions such as Remote Hosts, CurrentHosts etc.

A sample file will look like this:

##Go to Path
Function myFolder {Set-Location -Path "C:\Myfolder\"}
Function dev {Set-Location -Path "C:\DevFolder\"}

#Get version
Function Get-Version {$PSVersionTable.PSVersion}

#Alias Command
Function Pro {notepad $PROFILE.AllUsersCurrentHost}

#Alias to EXE
Set-Alias -Name mp -Value D:\Software\MyProgram.exe
Set-Alias -Name c -Value cls

#Customize prompt
Function Prompt
$env:COMPUTERNAME + "\" + (Get-Location) + "> "

Install Virtuoso 7 on Ubuntu 20.04 LTS

In order to install Virtuoso on Ubuntu 20.04 LTS the follwoing steps need to be followed:

# sudo apt-get install libtool
# sudo apt-get install dpkg-dev build-essential
# sudo apt update
# sudo apt-get install autoconf automake bison checkinstall flex gawk gperf libiodbc2  libiodbc2-dev libssl-dev libtool python-dev

Edit the source list sudo nano /etc/apt/sources.list to add the following line: deb xenial-security main Then 
# sudo apt update
# sudo apt install libssl1.0.0

# git clone
# cd virtuoso-opensource
# sudo git checkout stable/7 # Needed - flex/bison error in stable
# sudo ./
# sudo ./configure --with-layout=debian
# sudo make
# sudo make install

# Test that virt starts OK — ctrl-c to close after verifying
in /usr/bin/

sudo ./virtuoso-t -fd -c /var/lib/virtuoso-opensource-7/db/virtuoso.ini

How to Install CouchDB on Ubuntu 20.04 from

Apache CouchDB is a free and open-source NoSQL database developed by the Apache Software Foundation. It can be used as a single-node or clustered database.

CouchDB server stores its data in named databases, which contains documents with JSON structure. Each document consists of a number of fields and attachments. Fields can include text, numbers, lists, booleans, more. CouchDB includes a RESTful HTTP API that allows you to read, create, edit, and delete database documents.

This article covers the steps of installing the latest version of CouchDB on Ubuntu 20.04.

Installing CouchDB on Ubuntu is relatively straightforward. We’ll enable the CouchDB APT repository, import the repository GPG key, and install the CouchDB package.

Enabling CouchDB repository

Run the following commands as root or user with sudo privileges to enable the CouchDB repository and import GPG key:

curl -L | sudo apt-key add -echo "deb focal main" | sudo tee -a /etc/apt/sources.list

Installing CouchDB on Ubuntu

Once the repository is enabled, update the packages list and install CouchDB:

sudo apt updatesudo apt install couchdb

The installer will ask you whether you want to install CouchDB in a clustered or standalone mode. A cluster means multiple servers connected together, working as a single, distributed data store.

We will install CouchDB in a single-server standalone mode.

CouchDB Select Mode

Next, you’ll be given an option to set the IP address of the network interface on which the CouchDB will bind to. For a single-server setup, leave the default If you are configuring a cluster, enter the interface IP address or type, which tells CouchDB to binds to all network interfaces.

CouchDB Select Interface

On the next prompt, set the admin password. It is highly recommended to set the password, which will take CouchDB out of the insecure “admin party” mode. If you leave this field blank, an admin user will not be created.

CouchDB Create Admin

Finally, confirm the password, and the CouchDB installation will continue.

CouchDB Confirm Password

Verifying CouchDB Installation

The CouchDB server is running at localhost:5984. To verify whether the installation was successful and the service is running, run the following curl command that will print information about the CouchDB database in JSON format:


The output will look like this:

    "name":"The Apache Software Foundation"

For clarity the output above is formatted.

If you prefer GUI, you can access the CouchDB web-based interface, Fauxton at:


We’ve shown you how to install CouchDB on Ubuntu 20.04. You can find more information on this topic in the Apache CouchDB Documentation .

Entire Article was taken from . Original Link here:

AWS: Provide to a specific folder on S3, RW rights

Create an IAM role and add the following policy, to provide access to a specific older in a bucket on S3.

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "AllowUserToSeeBucketListInTheConsole",
            "Action": [
            "Effect": "Allow",
            "Resource": [
            "Sid": "AllowRootAndHomeListingOfCompanyBucket",
            "Action": [
            "Effect": "Allow",
            "Resource": [
            "Condition": {
                "StringEquals": {
                    "s3:prefix": [
                    "s3:delimiter": [
            "Sid": "AllowListingOfUserFolder",
            "Action": [
            "Effect": "Allow",
            "Resource": [
            "Condition": {
                "StringLike": {
                    "s3:prefix": [
            "Sid": "AllowAllS3ActionsInUserFolder",
            "Effect": "Allow",
            "Action": [
            "Resource": [