[PS] Working with Variables

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

Examples:

Storing strings
$Var=”Hello”

Storing integars
$Var=”5″
$Var=”1.0″

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”

epic
Author Details
Contributer and Author Enterprise Communications Engineer Hi Epic

testest test 

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments