PowerShell

In the modern world, everyone strives for automation. Automating everyday tasks increases efficiency and can avoid errors caused by repetitive monotonous work. PowerShell can be used to automate such mundane tasks.

PowerShell is the latest command line interpreter from Microsoft and largely replaces its predecessors - the Command Prompt, Windows Batch as well as VBScript.
The syntax of PowerShell is reminiscent of that of the Unix shell. PowerShell works with pipes and filters, is object-oriented and, in addition to the actual console, is a cross-platform scripting language with the help of which systems can be managed, configured or tasks automated.

Current PowerShell version:  7.4.6 (found: 2024-10-23)

Preview PowerShell Basics

Basics: Start console, execute commands

changed: 2023-04-11 from Bernhard (Initial Release: 2022-05-02)

PowerShell allows you to control or manage systems using the command line or run automated operations via Powershell scripts. ... continue reading

Preview Create, allow and run a Windows PowerShell Script

Basics: Create and run a Windows PowerShell Script

created: 2022-05-02 from Bernhard

In the simplest case, a PowerShell script is a text file containing a series of PowerShell commands. A PowerShell script is understood to be a file with the extension .ps1. The script file can contain a collection of commands, functions or cmdlets. ... continue reading

PowerShell Basics: Data, Loops and Conditions

PowerShell Basics: Data, Loops and Conditions

created: 2023-08-24 from Bernhard

Powershell arrays and objects and logic: If queries and loops. ... continue reading

Preview PowerShell editors in comparison: ISE, Visual Studio Code

PowerShell editors in comparison: ISE, Visual Studio Code

created: 2022-05-02 from Bernhard

Choosing the right editor can significantly simplify development, even though PowerShell scripts can theoretically be created in any text editor. The advantages of a PowerShell-optimized editor include syntax highlighting, auto-completion, code snippets, and a debugging mode that can step through the script line-by-line and analyze specific areas. For a long time, the standard PowerShell editor was the Windows-integrated PowerShell ISE, which does a good job especially for debugging ,but the IS... ... continue reading

Preview PowerShell - Best Practice - creating better scripts

PowerShell - Best Practice - creating better scripts

created: 2022-05-02 from Bernhard

PowerShell offers relatively much freedom in designing the scripts. In order to write scripts in a readable and understandable way, it is advantageous if certain rules are followed. In PowerShell, comments can be inserted to explain the code, or information about the script and help can be stored in the header of a cmdlet, and the possible parameters can be documented. Thegoal should be that the code is written as self-explanatory as possible, which makes some comments unnecessary and simplifies... ... continue reading

Preview PowerShell text file and csv read / write

PowerShell text file and csv read / write

created: 2022-05-02 from Bernhard

PowerShell text file and csv read / write ... continue reading

Using PowerShell to set file system permissions: ACL

Using PowerShell to set file system permissions: ACL

created: 2023-05-08 from Bernhard

To add a user with write permissions to an existing folder, the following script can be used: ... continue reading

Preview PowerShell: Prevent screen saver, lock: Move mouse regularly

PowerShell: Prevent screen saver, lock: Move mouse regularly

created: 2022-12-02 from Bernhard

Alternatively, if you can't change the screen lock settings, you can move the mouse regularly, or have a script move the mouse. Originally published as an AutoIt script, I recreated the script with a few PowerShell lines. Anyone who copies the following commands into a PowerShell session will prevent the computer from locking the screen or starting the screensaver: ... continue reading

Preview Restore file version history

Restore file version history

created: 2022-12-01 from Bernhard

The PowerShell script presented here copies the latest files of the file version history to any folder or to another computer. In the copy, the date is removed from the file name, thus restoring the original file names. ... continue reading

Preview PowerShell task scheduling: restart computer or server

PowerShell task scheduling: restart computer or server

created: 2022-11-15 from Bernhard

A scheduled task in Windows can of course also be created via PowerShell. ... continue reading

PowerShell: Read Active Directory data

PowerShell: Read Active Directory data

created: 2022-08-19 from Bernhard

Using Windows PowerShell to read Active Directory objects. ... continue reading

PowerShell TCP Listener

PowerShell TCP Listener

created: 2022-08-12 from Bernhard

PowerShell uses the following commands to open a socket on a specific port via System.NET: ... continue reading

Send PowerShell Email: Send-MailMessage

Send PowerShell Email: Send-MailMessage

created: 2022-12-09 from Bernhard

... continue reading

PowerShell Log-Files: Logging into a textfile - write to file

PowerShell Log-Files: Logging into a textfile - write to file

created: 2022-05-05 from Bernhard

Log files in PowerShell can be created via the Out-File command, via a custom function, or via PowerShell's built-in Transcript. ... continue reading

PowerShell: File attributes: Change date - without any tools.

PowerShell: File attributes: Change date - without any tools.

created: 2022-05-03 from Bernhard

As an alternative to special programs, the date of a file or folder can also be changed with PowerShell.  ... continue reading

Preview PowerShell - Handling passwords.

PowerShell - Handling passwords.

created: 2022-05-02 from Bernhard

Of course, passwords should never be stored in plain text in a script file. PowerShell offers possibilities for a secure handling of passwords. As an example, a password for a specific user can be stored encrypted as a text file. Only the respective user can decrypt the file, for other users the file is worthless. ... continue reading

PowerShell read Eventlog

PowerShell read Eventlog

created: 2022-05-02 from Bernhard

With the command "Get-WinEvent" the Windows Eventlog can be accessed via PowerShell ... continue reading

Preview Powershell ISE - Snippet | Templates

Powershell ISE - Snippet | Templates

created: 2022-05-02 from Bernhard

Snippets are script templates. For example a "do-until" or "for" loop or a template for a cmdlet. By selecting a snippet, the sample code is inserted into the editor. Powershell ISE, see also: how to create a PowerShell script ... continue reading

Übersetzung Deutsch

By continuing to browse the site, you agree to our use of cookies. More Details