Home > Powershell > [PS] Working with Variables

[PS] Working with Variables

Variables uses the $ (Dollar Sign). Takes text, integers, and store output from cmdlets.


Storing strings

Storing integars

Storing output from cmdlets
$Var=Get-Services bits (Grabs a Service Controller Object)
– $Var.status would output status
– $Var.stop() would stop bits services
– $Var.refresh() refreshes the storage

Storing using user input

$Var=Read-host “Enter string to be stored”

Categories: Powershell Tags:
  1. No comments yet.
  1. No trackbacks yet.