Is there a way to define a variable in PowerShell so when I open up a new PowerShell window, it'll keep the same value?
I'll need this variable to keep its value, because I'll be needing to reboot my server every now and then, and I don't want to lose these values.
To store:
$variable|export-clixml -path $Location
To retrieve:
$variable = import-clixml -path $Location
Put that in a function if you want it, something like:
function LoadTHEvariable($location)
{
$global:variable = import-clixml -path $Location
}
$location obviously contains the place in the filesystem where do you want to store the variable.