Hello.
I'm hoping some experienced PowerShell scripting person can assist. I am relatively new to PS scripting with Veeam. I see a number of scripts contain "Methods". Something like; $A=VBRVar.GetAllStorages(). The question I have is where do I find out the syntax of "GetAllStorages" and the values that it returns? How do I get a list of "Methods" that are associated with a Get-VBRcommand?
Any assistance will be very much appreciated. :c)
Cheers!
Keith
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jul 21, 2023 9:44 am
- Contact:
-
- Veeam Software
- Posts: 2566
- Liked: 603 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Command Syntax
Hi @Keefie22,
Welcome to the forums
Thing is, those are .NET methods, and these are not supported methods. See my answer here for more details on supported/unsupported: post477483.html#p477483
So in short, for right now I recommend avoid using those methods, as while you _can_ use them safely, they change frequently from update to update as they're not meant for public use, it's just a thing that is part of Powershell sometimes. We're working to make the returned objects from our cmdlets "more safe", and return the top level data specifically.
In general, I would recommend avoiding unsupported methods that require arguments; normally you would just use the Get-Member command or the GetType() method on the returned object and then check the arguments each one takes, but this process expects you have a pretty strong understanding of our database structure and the internal code flows to understand what the methods do/arguments they take. For something like GetAllStorages(), it accepts no arguments, and these are the only types of methods I _might_ dip into for any real scripting. With GetType, you'd save the result to some variable, and the result will have a GetMethods() call which returns the methods in full.
(Just a note: you might get scripts with unsupported methods from Support to fix cosmetic issues on cases; this is do avoid having you backup the DB, upload it to support, support downloading the DB, and then preparing an SQL query; it's safe in these regards because it mimics what the SQL queries would do, but saves you a lot of time)
Welcome to the forums

Thing is, those are .NET methods, and these are not supported methods. See my answer here for more details on supported/unsupported: post477483.html#p477483
So in short, for right now I recommend avoid using those methods, as while you _can_ use them safely, they change frequently from update to update as they're not meant for public use, it's just a thing that is part of Powershell sometimes. We're working to make the returned objects from our cmdlets "more safe", and return the top level data specifically.
In general, I would recommend avoiding unsupported methods that require arguments; normally you would just use the Get-Member command or the GetType() method on the returned object and then check the arguments each one takes, but this process expects you have a pretty strong understanding of our database structure and the internal code flows to understand what the methods do/arguments they take. For something like GetAllStorages(), it accepts no arguments, and these are the only types of methods I _might_ dip into for any real scripting. With GetType, you'd save the result to some variable, and the result will have a GetMethods() call which returns the methods in full.
(Just a note: you might get scripts with unsupported methods from Support to fix cosmetic issues on cases; this is do avoid having you backup the DB, upload it to support, support downloading the DB, and then preparing an SQL query; it's safe in these regards because it mimics what the SQL queries would do, but saves you a lot of time)
David Domask | Product Management: Principal Analyst
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Jul 21, 2023 9:44 am
- Contact:
Re: Command Syntax
Hello David.
Thanks for the welcome, and advice. That does make sense. There does appear to be few commands that shown capacity info of jobs though. Thus I'll use GetAllStorages(), for this but i'll keep in mind that it is unsupported.
Cheers!
Keith
Thanks for the welcome, and advice. That does make sense. There does appear to be few commands that shown capacity info of jobs though. Thus I'll use GetAllStorages(), for this but i'll keep in mind that it is unsupported.
Cheers!
Keith
-
- Veeam Software
- Posts: 2566
- Liked: 603 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: Command Syntax
Always welcome @Keefie22, and glad I could advise 
Best way to figure out how to do it "supported" would be just to ask on the forums in a thread, so we can definitely help guide you towards supported items as you develop your scripts more, and advise when unsupported means might be applicable.

Best way to figure out how to do it "supported" would be just to ask on the forums in a thread, so we can definitely help guide you towards supported items as you develop your scripts more, and advise when unsupported means might be applicable.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 11 guests