Powershell copy files from directory excluding certain extensions

In Powershell you can use the pipe symbol “|” to chain certain commands together. This enables you to make powerful scripts. One example how you can use this is to recursively copy files from one location to another, but exclude certain files based on the filename or extension. Example 1: copy all files from one… Continue reading Powershell copy files from directory excluding certain extensions

Powershell open a new file explorer window in a specific location

In order to open a new file explorer window in a specific location from Powershell, you can use the following very simple command in a Powershell script: This can come in handy in certain cases. For example if you are making a script that places files in a certain location, and you then want the… Continue reading Powershell open a new file explorer window in a specific location

Published
Categorized as Powershell

Telnet equivalent in Powershell to test if port is reachable

Powershell doesn’t come with telnet by default, however you can use the following command to quickly connect to a TCP server in a Powershell window. 1. Test-NetConnection The simplest option is to use the command “Test-NetConnection”. With this command you can specify a computername (or IP address) and port to check if a connection can… Continue reading Telnet equivalent in Powershell to test if port is reachable

Published
Categorized as Powershell

Powershell script run as administrator / elevated mode check

If you created a Powershell script which needs administrator permissions, and you try to run it as a normal user (e.g. when simply double clicking the .ps1 file), you might see errors such as “Access denied”. To fix this, you will need to run the Powershell script as Administrator. However this usually means you need… Continue reading Powershell script run as administrator / elevated mode check

Published
Categorized as Powershell

Powershell error: the file is not digitally signed. You cannot run this…

If you are trying to run a custom Powershell (.ps1) script, you might see the following error: This problem is caused by the default Execution-Policy which prevents you from running custom Powershell scripts. Solution: change execution policy To fix this, open up a Powershell prompt as an Administrator: Then in the Powershell prompt, enter the… Continue reading Powershell error: the file is not digitally signed. You cannot run this…

Published
Categorized as Powershell