Forum Discussion
Assistance with looping through multiple subscriptions
I modified the script as mentioned by you. However, I'm getting the below error message: ( if you can assist fixing it will be highly appreciated )
Line |
160 | $Obj=.\Get-AzVMBackupInformation.ps1 -AllVirtualMachines
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term '.\Get-AzVMBackupInformation.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that
| the path is correct and try again.
Export-Csv: Cannot bind argument to parameter 'InputObject' because it is null.
== My Objective is to execute the above code for multiple subscription ==
I have modified the above script to capture VM TAG details and VM subscription details.
I'm unable to get an accurate subscription details.
I executed the below code ( --> It is getting looping through multiple subscription. However I'm not getting subscription name in the output csv file)
====Code====
Hello Subhankar131,
Get-AzVMBackupInformation.ps1 is the name of the function that you posted.
So the algorithm is the following. Save your posted function to Get-AzVMBackupInformation.ps1 file and then code that I've provided is additional function which will executed the existing one.
Hope that helps.
- Subhankar131Feb 28, 2023Copper Contributor
Hello AndySvints,
Thank you for your clarification.
The above code mentioned by you it works. I need to Export it to a csv file along with subscription name mentioned with VM details. Can it be addressed by modifying your code?
- Subhankar131Feb 28, 2023Copper Contributor
- AndySvintsFeb 28, 2023Steel Contributor