Powershell profile error
The term '.ViewEntireForest = True' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\Documents and Settings\user\My Documents\WindowsPowerShell\Microsoft.P
owerShell_profile.ps1:2 char:2
+ & <<<< "$AdminSessionADSettings.ViewEntireForest = $true"
+ CategoryInfo : ObjectNotFound: (.ViewEntireForest = True:String
) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundExceptionI'm new to powershell and I've looked at some of the tutorials but I'm getting the following error when I try to load a profile that I modified;
Here's the profile;
Set-Location c:\
& "$AdminSessionADSettings.ViewEntireForest = $true"
I'm sure its something simple that I'm overlooking. I'd appreciate any help.
Thanks,
D
July 15th, 2011 4:25pm
See if this helps -
http://blogs.technet.com/b/evand/archive/2007/02/14/adminsessionadsettings-and-you.aspxSukh
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 4:31pm
Sorry I think I overwrote my initial question. I'm getting the error after I've added the commands in the profile. I've added the "$AdminSessionADSettings.ViewEntireForest = $true" command as part of the profile but I keep getting the error;
The term '.ViewEntireForest = True' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At C:\Documents and Settings\user\My Documents\WindowsPowerShell\Microsoft.P
owerShell_profile.ps1:2 char:2
+ & <<<< "$AdminSessionADSettings.ViewEntireForest = $true"
+ CategoryInfo : ObjectNotFound: (.ViewEntireForest = True:String
) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Thanks,
D
July 15th, 2011 5:20pm
is there an & there? remove & and testSukh
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2011 6:58pm
Could you please try this command via Exchange 2007 EMS?
[PS] C:\Document and settings\ Administrator>$adminsessionADsettings
[PS] C:\Document and settings\Administrator>$adminsessionADsettings.ViewEntireForest=$true
What’s the version of OS you run the script?
Could you please post your script?
July 18th, 2011 4:18am
Try changing your profile From:
Set-Location c:\
& "$AdminSessionADSettings.ViewEntireForest = $true"
TO:
Set-Location c:\
Add-PSSnapin *Exchange* -ErrorAction SilentlyContinue
$AdminSessionADSettings.ViewEntireForest = $true
DJ Grijalva | MCITP: EMA 2007/2010 | www.persistentcerebro.com
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2011 9:51am
DJ,
That worked thanks. I have another question. We are migrating our Exchange server from 2007 to 2010 and I've been trying to change the profile by modifying Exchange.ps1. I noticed the line in the script "set-adserversettings -viewentireforest
$false" and changed it to '$true' but when I launch the shell it hasn't changed the 'viewentireforest' value to true. I can run the script again from the shell and it does change it to true. Any ideas why it doesn't change the value?
Thanks,
D
July 18th, 2011 12:25pm
My opinion would be to leave the default exchange.ps1 alone and just modify the default users profile so it will apply to all the users on you Utility machine. The default profile should be at "C:\Windows\System32\WindowsPowerShell\v1.0" then it will
apply to any instance of powershell that a user opens, whether its the Exchange shell link or just running powershell.exe
DJ Grijalva | MCITP: EMA 2007/2010 | www.persistentcerebro.com
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2011 3:47pm
It looks like set-adserversettings" can only be applied per instance. I get the this error;
The term 'get-adserversettings' is not recognized as the name of a cmdlet, func
tion, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At C:\Users\administrator\Documents\WindowsPowerShell\Microsoft.PowerShell
_profile.ps1:2 char:21
+ get-adserversettings <<<<
+ CategoryInfo : ObjectNotFound: (get-adserversettings:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Here's the powershell profile;
Set-Location 'c:\program files\microsoft\exchange server\v14\bin'
get-adserversettings
Thanks,
D
July 19th, 2011 2:32pm