I am a desktop tech. I write small scrips for my co-workers to do easy tasks like join a domain or gather information from a device. I am a beginner(ish) with powershell.
I was wondering if there was a way to have Powershell to ask you if you would like to write the information to a file after displaying it on the screen.
Simple Example:
Write-Host "This will get you the current logged in user" -ForegroundColor Red -BackgroundColor Yellow
$device = Read-Host "Type in the device ID here"
Get-WmiObject –ComputerName $device –Class Win32_ComputerSystem | Select-Object UserName
Write-host "Would you like to write this to a file"
What comes next??