Search notes:

PowerShell cmdLet: Read-Host

read-host reads a line of input.
Usually, read-host is used to assign a text that is entered by a user to a variable:
$val = read-host
write-output $val

Adding a prompt

With -prompt, the user is shown a text after which the value can be entered:
$val = read-host -prompt 'Please enter a value'
Because -prompt is the first parameter of read-host, the string -prompt can also be left out.

Entering secure strings

With -asSecureString, the entered value is masked with asterisks and read-host returns a System.Security.SecureString:
PS C:\> $sec = read-host -prompt 'Password' -asSecureString
Password: ******
PS C:\> $sec
System.Security.SecureString
PS C:\> convertFrom-secureString $sec
01000000d08c9ddf0115d1118…

See also

Powershell command noun: host

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/...', 1759390762, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/command-inventory/noun/host/read/index(61): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78