powershell documentation

PowerShell script exchange

powershell documentation

Veeam Logoby jftuga » Mon Jan 24, 2011 11:02 pm

Where is the documentation for the powershell api? I want to create about 25 different jobs -- the only differences being the server that is getting backed up and the target directory. I figured it would be quicker to do this through PS rather than the GUI.

Also, any examples on how to do this would be greatly appreciated! :D

Thanks,
-John
jftuga
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Oct 22, 2010 7:02 pm
Location: Athens, GA
Full Name: John Taylor

Re: powershell documentation

Veeam Logoby jftuga » Mon Jan 24, 2011 11:14 pm

OK, I found the PS documentation in the User Guide. I am still not sure where to start. I have Server 2008 R2 w/ PS version 2. I start powershell from the Start Menu, but none of the Get-VBR cmdlets seem to work. It says the command is not recognized as the name of cmdlet, function, or script file. Is there some special way that PS needs to be invoked in order for these cmdlets to work?

Thanks,
-John
jftuga
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Oct 22, 2010 7:02 pm
Location: Athens, GA
Full Name: John Taylor

Re: powershell documentation

Veeam Logoby jftuga » Mon Jan 24, 2011 11:21 pm

OK, I just found out how to get this working. Within Veeam, Tools -> PowerShell. One more question, however. If I wanted to start a Veeam PS script from a batch file (that periodically ran from Task Scheduler), how would I invoke the PS script from within the batch file itself?
jftuga
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Oct 22, 2010 7:02 pm
Location: Athens, GA
Full Name: John Taylor

Re: powershell documentation

Veeam Logoby paul » Mon Jan 24, 2011 11:56 pm

paul
Novice
 
Posts: 4
Liked: never
Joined: Sun Jan 01, 2006 1:01 am

Re: powershell documentation

Veeam Logoby jftuga » Tue Jan 25, 2011 3:11 pm

Hi Paul,

Please post something actually useful. For example, *which* PS script to run from the batch file. When you access the PS prompt from the GUI, it is unclear which PS script is invoked to get the Veeam cmdlets loaded. This is not mentioned in the User Guide either.

-John
jftuga
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Oct 22, 2010 7:02 pm
Location: Athens, GA
Full Name: John Taylor

Re: powershell documentation

Veeam Logoby Vitaliy S. » Tue Jan 25, 2011 4:11 pm

John, the syntax is fairly simple.

First of all you should add the line below to your_script.ps1. Please note that you should add this before executing any commands, as this line should register Veeam Snap-in in Powershell:
Code: Select all
Add-PSSnapin VeeamPSSnapIn

Then use Windows Scheduler to trigger you batch file, which will contain the line below:
Code: Select all
powershell.exe .\Your_script.ps1

Hope it helps!
Vitaliy S.
Veeam Software
 
Posts: 19564
Liked: 1104 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: powershell documentation

Veeam Logoby Gostev » Tue Jan 25, 2011 4:36 pm

jftuga wrote:Please post something actually useful.

To be fair to Paul, he did answer the exact question that you have asked, so it is hard to call his response "not useful". :D

jftuga wrote:For example, *which* PS script to run from the batch file.

The one you wanted to run according to your 3rd post above? I don't understand this question...

jftuga wrote:When you access the PS prompt from the GUI, it is unclear which PS script is invoked to get the Veeam cmdlets loaded.

What do you mean? There is no script invoked when you open PS prompt - it is just a command prompt. Just like there is no script invoked when you open regular command prompt with cmd.exe - it is there for you to type in and execute the commands.

Loading Veeam cmdlet with the above command just add "namespace" to your script (or PS prompt session for that matter), so that you can start calling Veeam PS commands in it.

jftuga wrote:This is not mentioned in the User Guide either.

Well, you really need to be looking at PowerShell documentation for this kind of information, not our User Guide. Basically, we assume that anyone who wants to create PowerShell scripts with our extensions will have basic understanding of PowerShell.
Gostev
Veeam Software
 
Posts: 21396
Liked: 2349 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: powershell documentation

Veeam Logoby jftuga » Tue Jan 25, 2011 6:25 pm

This is how you pull up the Exchange Mgmt Shell:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'"

So I thought there was a ps1 file that needed to be loaded. My apologies for the confusion on my part.

-John
jftuga
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Oct 22, 2010 7:02 pm
Location: Athens, GA
Full Name: John Taylor


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests