1) not until v2 (which is a long way off.) You can do alot with WMI and .NET
though. Just need an idea of what your trying to do.
2) You can find this info in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment which you can access via a .NET object.
Here is an example
$srv = "Computer"
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,
$Srv)
$key = $regKey.OpenSubkey("SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$true)
$key.GetValueNames() | Select-Object @{n="ValueName";e={$_}},@{n="Value";e={$key.GetValue($_)}}
Brandon Shell
---------------
Blog:
http://www.bsonposh.com/
PSH Scripts Project:
www.codeplex.com/psobject
F> Kiron, Brandon, Marco, Shay,
F>
F> Thanks for all your fast replies! I am new to powershell so your
F> expertise is invaluable to me.
F>
F> Your examples worked perfect for me and now I know about the env
F> variables. I do have two questions for you all though.
F>
F> 1. I am going to be needing to do a lot of work with PowerShell on
F> remote machines. PowerShell seems great when running stuff locally
F> but I am finding trouble trying to take what is simple locally and
F> then applying it to remote machines. Is there some way to create an
F> object of a remote machine so that whatever I execute can be ran
F> against the remote machine?
F>
F> 2. For this example of the env variables, is it possible to access
F> the env variable of a remote machine? Basically there are files that
F> I need to copy from the %temp% directory of a given server and while
F> the command $env:temp is great for my machine, I don't know how to
F> apply it to a remote machine.
F>
F> Thanks to all for your advice and assistance!
F>
F> -Flea#
F>
F> "Shay Levi" wrote:
F>
>> PowerShell keeps environemnt variables in a special PSDrive called:
>> env
>>
>> To get all environment variables, type:
>>
>> dir env:
>>
>> To get a specific variable, type:
>>
>> $env:<variableName>, as in:
>>
>> get-childitem $env:temp
>>
>> -----
>> Shay Levi
>> $cript Fanatic
>> http://scriptolog.blogspot.com
>>> I need to be able to access some files in the %temp% directory on
>>> the computer and I am unable to open that directory in PowerShell.
>>> If I open a cmd.exe window, I can simple type cd %temp% and it opens
>>> just fine. Is there any reason why PowerShell would have issues
>>> with this?
>>>
>>> Thanks,
>>> -Flea#