Search notes:

PowerShell: Script block

A script block is essentially an anonymous function (see functions seem to be a script block) and thus consists of a series of statements and expressions. It accepts arguments and might return a value.
A script block is category of commands as are for example functions or «ordinary» scripts.
A script block is identified by the curly brackets that contain it. In PowerShell, anything within curly brackets, except hash tables, are script blocks.
A script block is an instance of the .NET framework type System.Management.Automation.ScriptBlock:
PS C:\> {}.GetType().FullName
System.Management.Automation.ScriptBlock
As any other object, a script block can be assigned to a variable.
The script block that the variable references can then be called with the call operator (&) (See here).
A script block that is assigned to a variable might also be invoked with the invoke-command cmdLet.
Script blocks might be also used as a scheduled job (that was started with start-job).
Within a pipeline, a script block can be executed for each element in the pipeline with the forEach-object cmdLet.

See also

The time a script block needs until it is finished can be measured with the measure-command cmdLet.
The automatic variable $psItem (for which $_ is an alias).
The script block is only recognized in argument parsing mode
A dynamic module can be created from a script block with new-module.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758194139, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/scriptblock/index(71): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78