0

I have a line in vbscript Functioncall=x(0).Subdomain(0) here functioncall is the name of a function Now I need to rewrite this script into powershell..Do i need to write it like Functioncall=$x.Item(0).Subdomain.Item(0) (or) Functioncall=$x.Item(0).Subdomain(0)

Sanju R
  • 3
  • 2
  • If you are returning a value from your function, you need to use ```return $x.Item(0).Subdomain.Item(0)``` – pelin72 Oct 12 '22 at 06:18
  • If "*`Functioncall=x(0).Subdomain(0)` here functioncall is the name of a function*", I would expect the word `function` somewhere in your example. (please read [how to ask](https://stackoverflow.com/help/how-to-ask)). Anyways, if you coming from another (scripting) language you might want to make yourself familiar with a few [pitfalls in PowerShell](https://stackoverflow.com/a/69644807/1701026). For your particular question: *1.* [parentheses and commas are not used with arguments](https://stackoverflow.com/q/4988226/1701026). *2.* Indices are surrounded with square brackets, e.g.: `[0]`. – iRon Oct 12 '22 at 06:44

0 Answers0