commandline error

Topics: Developer Forum, User Forum
May 11, 2007 at 4:43 AM
When I try and run a cmdlet from a command prompt with the following syntax the env variable doesn't seem to be set:

C:\ps>powershell -command "& {get-eventlog -logname security}"
Update-FormatData : Cannot find path 'C:\FormatData\FileSystem.ps1xml' because
it does not exist.
At C:\Documents and Settings\mla\My Documents\WindowsPowerShell\profile.ps1:103
char:19
+ Update-FormatData <<<< -PrependPath "$Env:PscxHome\FormatData\FileSystem
.ps1xml"

Any suggestions on how to run from the command prompt would be appreciated. I need to be able to run scripts in batch mode at the beginning and end of a backup process.

Thanks!
Coordinator
May 11, 2007 at 7:41 AM
It sounds like the new PowerShell instance isn't seeing the PscxHome environment variable that the installer creates. Check this by executing:

gci env:PscxHome

Usually a reboot solves this.
May 11, 2007 at 4:43 PM
Thanks that did the trick! I thought because I saw it listed in the environment variables it would take but the reboot was required.
Coordinator
May 12, 2007 at 7:05 AM
I've seen this before but I don't get it. I thought that since Win2K or XP a reboot wasn't required for a new environment variable to take effect. Hmm...
Developer
May 18, 2007 at 4:17 AM

rkeithhill wrote:
I've seen this before but I don't get it. I thought that since Win2K or XP a reboot wasn't required for a new environment variable to take effect. Hmm...


That's true ... although not for existing instances (at least, not of cmd.exe ... there's a window message you have to handle) and not always when you're running an alternate shell (i.e.: not explorer, but geoshell, litestep, or something) although I don't understand why.