01-08-2009 02:35 PM
I did search the forum, and then the web a bit, but i'm having some trouble using the EV8 'cmdlets' to set/clear the backup mode on the site, indexes, etc. my goal is to create pre/post scripts for backing up EV.
The commands mentioned in the admin guide work fine when I open the EV command shell, but when i put them into a .psc1 script i cannot execute it, powershell complains.
Has anyone created these script files that may be able to assist?
Solved! Go to Solution.
01-12-2009 05:34 PM
You need to tell Powershell to load the EV snapin. It shoudl then know about the EV specific commandlets.
You will have to add the following to your command line:
-psconsolefile "C:\Program Files\Enterprise Vault\EVShell.psc1"
EG:
powershell -psconsolefile "C:\Program Files\Enterprise Vault\EVShell.psc1" backup.psc1
there is a reference to this in the readme for EV8.
Ben Jackson
..
01-08-2009 03:48 PM
As you have not provided the script or the error details it is difficult to say but a couple of things I can ask now are:-
1. Did you by any chance install powershell after you installed EV? I ask this as Power Shell Cmdlets need to be registered with Windows PowerShell. Window PowerShell is a free download and not bundled with Windows Operation System, so in case where an admin installs PowerShell after EV, then EV PowerShell Cmdlets need to be registered manually
2. When you are running the script are you running it as a user that has the relevant rights to run these commands.
There also should be some powershell examples in the documentation but I am not in a position currently to look and confirm that.
01-09-2009 12:46 PM
How can i register the EV cmdlets?
PowerShell was installed after EV. As i said they work fine in the EV mamagement console but not when i try to run them as a script :
C:\>powershell c:\test.ps1
The term 'Get-IndexLocationBackupMode' is not recognized as a cmdlet, function,
operable program, or script file. Verify the term and try again.
At C:\test.ps1:1 char:28
+ Get-IndexLocationBackupMode <<<< evsite
Thanks!
01-09-2009 03:50 PM
Hi,
These are example of how the syntax should be
et-indexlocationbackupmode -evservername server1get-indexlocationbackupmode -evservername server1 -evsitename "demo site"get-indexlocationbackupmode -evservername server1 -indexrootpath "g:\Indexes\location1"
01-09-2009 04:05 PM
Yep, you're right! And they all work great when I run them in the Enterprise Vault Management Shell.
However, We cannot run these commands manually before/after every backup is done of EV. Can you provide examples of how this would look in script we could run from Netbackup as part of a pre/post backup job?
When I put these working commands into a powershell script and try to execute them, that's when I'm out of luck.
C:\>powershell c:\test.ps1
The term 'Get-IndexLocationBackupMode' is not recognized as a cmdlet, function,
operable program, or script file. Verify the term and try again.
At C:\test.ps1:1 char:28
+ Get-IndexLocationBackupMode <<<< evsite
the file test.ps1 contains ONLY "Get-IndexLocationBackupMode evsite" in it for testing. This command works just fine when i type it into the shell and execute it.
01-09-2009 04:39 PM
01-11-2009 05:42 PM
I haven't installed EV8 yet, but it looks similar to Exchange 2007 powershell windows. Could it be that you are running the script from the wrong location? If you use powershell as installed by windows, it will not know about commands from EV. You may need to call the EV powershell instance, then run the script from there.
01-11-2009 06:37 PM
I should clarify, when you call EV powershell, it may call powershell with an EV shell. Check thepath on the EV powershell shortcut, it should show you the syntax to call the shell.
01-12-2009 02:12 PM
01-12-2009 02:18 PM
The command i'm testing in the script does work in the EV management shell and the normal powershell (i just open cmd prompt and type 'powershell').
I believe i'm just not building my script correctly.
01-12-2009 05:34 PM
You need to tell Powershell to load the EV snapin. It shoudl then know about the EV specific commandlets.
You will have to add the following to your command line:
-psconsolefile "C:\Program Files\Enterprise Vault\EVShell.psc1"
EG:
powershell -psconsolefile "C:\Program Files\Enterprise Vault\EVShell.psc1" backup.psc1
there is a reference to this in the readme for EV8.
Ben Jackson
..
01-13-2009 02:29 PM
Thank you Faxson! I did overlook this in the ReadMe, hopefully the documentation will have similar examples at some point.
This is exactly what I needed.