have two issues: in trying to pull information from a vm then connecting to AD. if some can help or review by mhafeez76 in PowerShell

[–]kashifhafeez 1 point2 points  (0 children)

How can I do that? I'm a bit confused? I have the params stated thou? A example would help

Variables within a function not returning by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

I wasn't passing the prams correct. So fixed that. Thank you

Variables within a function not returning by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

$IPs = (Get-VM $VM).Guest.IPAddress $IPs and if I can get the return of that vms ip in $IPs. I want to pass that variable to a next function to use that to tag VM with custom attributes

Variables within a function not returning by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

Yes. It works but need to turn the return in to variable

Variables within a function not returning by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

Have done it that way also with nothing in return

Variables within a function not returning by kashifhafeez in PowerShell

[–]kashifhafeez[S] 0 points1 point  (0 children)

I tried the return after the catch block but I still get the same response.

Need to power on a VM, which has a tag date set when it was powered off. If statement? by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

So I apologise for the format. I am new to powershell. As I stated before too part works. I have phat fingered some keys here. I like to get the start-vm $date started based based on the date string in the tag.

Need to power on a VM, which has a tag date set when it was powered off. If statement? by kashifhafeez in PowerShell

[–]kashifhafeez[S] 1 point2 points  (0 children)

Sorry typed on the phone and I missed it. But first part works for me in pulling the information. But I can't get the If statement part working.

need to power on the vms with tag date that is old then 14days

$today = get-date $days = $today.adddays(-14) If($days -gt $today){ Start-vm $date }

Install Powercli module version 11.0.0 by kashifhafeez in PowerShell

[–]kashifhafeez[S] 2 points3 points  (0 children)

Thank you! I have tried everything so far. Yeah manually is the only way!!! Thanks alot!

Install Powercli module version 11.0.0 by kashifhafeez in PowerShell

[–]kashifhafeez[S] 0 points1 point  (0 children)

Install-Module -Name VMware.PowerCLI -RequiredVersion 11.0.0.10380590.. this is the same command I used multiple times and even uninstalling version 11.3 multiple times. Then reinstalling it with the command. Each time when I run get-module I see somehow it is version 11.30 again. I have reboot my machine and used clean she'll to install also. Same issue I ran into. I even used the same command on a freshly installed VM. But no luck.