Automation

 View Only
Expand all | Collapse all

Scripts Failing Suddenly

pamiller21

pamiller21Jul 18, 2018 08:51 PM

  • 1.  Scripts Failing Suddenly

    Posted Jul 09, 2018 04:14 PM

    I have had a number of scripts fail recently, I run the script manually and here is the script and output:

    #############################

    # Connect to vCenter        #

    #############################

    Start-Transcript -Path 'C:\Temp\script.log'

    Import-Module -Name VMware.PowerCLI

    Set-PowerCLIConfiguration -DisplayDeprecationWarnings $false -InvalidCertificateAction ignore -confirm:$false

    $vc = 'DNS'

    $Cred = Import-Clixml C:\util\Scripts\creds\autoitjob.xml

    Connect-VIServer $VC -Credential $Cred

    #############################

    #         Variables         #

    #############################

    $date=Get-Date -format "yyyy-MMM-d"

    $datetime=Get-Date

    $filelocation="C:\util\Scripts\Temp\Thin-$date.htm"

    #############################

    #          Content          #

    #############################

    $report = Get-VM | Get-HardDisk | where {$_.StorageFormat -ne "Thin"} | select Parent,StorageFormat,Filename

    #$report = Get-VM | Get-HardDisk |

    #where {$_.StorageFormat -ne "Thin"} |

    #select Parent,StorageFormat,Filename

    #############################

    # Add Text to the HTML file #

    #############################

    $report | ConvertTo-Html -title "VMware Thin Provision Check" -body "<H1>Vmware Thin Provision Check</H1>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File $filelocation

    ConvertTo-Html -title "VMware Thin Provision Check" -body "<H4>Date and time </H4>",$datetime -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

    ConvertTo-Html -title "VMware Thin Provision Check" -body "<H4>VM Count</H4>",$report.Count -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

    ######################

    # FTP HTML output #

    #####################

    #we specify the directory where all files that we want to upload 

    $Dir="$filelocation"

    #Below for test

    #$Dir="C:/Users/administrator/Desktop/tmp/"   

    #ftp server

    $ftp = "ftp://IP/internal-backups/datacenter/vcenter/misc-reports/Thin/"

    $user = "USER"

    $pass = "PW" 

    $webclient = New-Object System.Net.WebClient

    $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass) 

    #list every sql server trace file

    foreach($item in (dir $Dir "*.bak")){

        "Uploading $item..."

        $uri = New-Object System.Uri($ftp+$item.Name)

        $webclient.UploadFile($uri, $item.FullName)

    }

    ##############################

    # Disconnect session from VC #

    ##############################

    disconnect-viserver -confirm:$false

    OUTPUT:

    PS C:\util\scripts\Reports\Daily> .\ThinReport.ps1

    Transcript started, output file is C:\Temp\script.log

    Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout

                                                                                                      Seconds

    -----    -----------     ------------------- ------------------------  -------------------------- -------------------

    Session  UseSystemProxy  Multiple            Ignore                    False                      300

    User                     Multiple            Ignore                    False

    AllUsers

    IsConnected   : True

    Id            : /VIServer=vsphere.local\powercli@DNS:443/

    ServiceUri    : https://vcenter6.ruralnex.com/sdk

    SessionSecret : "7f2930a91d58a037dd232de769e26727c3338c71"

    Name          : vcenter6.ruralnex.com

    Port          : 443

    SessionId     : "7f2930a91d58a037dd232de769e26727c3338c71"

    User          : VSPHERE.LOCAL\PowerCLI

    Uid           : /VIServer=vsphere.local\powercli@vcenter6.ruralnex.com:443/

    Version       : 6.5.0

    Build         : 8667236

    ProductLine   : vpx

    InstanceUuid  : e66b929f-6e6e-4791-aafc-621177fc31b1

    RefCount      : 1

    ExtensionData : VMware.Vim.ServiceInstance

    Get-VM : 7/9/2018 11:01:54 AM   Get-VM          Value cannot be null.

    Parameter name: array

    At C:\util\scripts\Reports\Daily\ThinReport.ps1:22 char:11

    + $report = Get-VM | Get-HardDisk | where {$_.StorageFormat -ne "Thin"} ...

    +           ~~~~~~

        + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException

        + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

    Uploading C:\util\Scripts\Temp\Thin-2018-Jul-9.htm...



  • 2.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 05:50 PM

    Which versions of PowerShell and PowerCLI are you using?

    Did you do a recent update of PowerCLI? Or PowerShell?

    Did you stop/start your PowerShell session from which you start the scripts?



  • 3.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 06:08 PM

    PowerShell: 10.0.14393.0

    PowerCLI: 10.1.0.8403314

    I haven't updated anything, and only about half my scripts are failing.

    I have rebooted the script server entirely.  Issue still continued.

    Thank you for your help so far!



  • 4.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 06:14 PM

    That PowerShell version seems odd.

    Check what is in $PSVersionTable.

    Can you do this and check the versions fo the PowerCLI modules?

    Get-Module -Name VMware* -ListAvailable |

    Select Name,Version



  • 5.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 06:51 PM

    Very sorry I ran a different command, but this is the version I get:

    Name                           Value

    ----                           -----

    PSVersion                      5.1.14393.2273

    PSEdition                      Desktop

    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

    BuildVersion                   10.0.14393.2273

    CLRVersion                     4.0.30319.42000

    WSManStackVersion              3.0

    PSRemotingProtocolVersion      2.3

    SerializationVersion           1.1.0.1

    VMware.DeployAutomation             6.7.0.8250345

    VMware.ImageBuilder                 6.7.0.8250345

    VMware.PowerCLI                     10.1.0.8403314

    VMware.Vim                          6.7.0.8343295

    VMware.VimAutomation.Cis.Core       10.1.0.8377811

    VMware.VimAutomation.Cloud          10.0.0.7893901

    VMware.VimAutomation.Common         10.1.0.8342134

    VMware.VimAutomation.Core           10.1.0.8344055

    VMware.VimAutomation.HA             6.5.4.7567193

    VMware.VimAutomation.HorizonView    7.1.0.7547311

    VMware.VimAutomation.License        10.0.0.7893904

    VMware.VimAutomation.Nsxt           10.1.0.8346947

    VMware.VimAutomation.PCloud         10.0.0.7893924

    VMware.VimAutomation.Sdk            10.1.0.8342078

    VMware.VimAutomation.Srm            10.0.0.7893900

    VMware.VimAutomation.Storage        10.1.0.8313015

    VMware.VimAutomation.StorageUtility 1.2.0.0

    VMware.VimAutomation.Vds            10.1.0.8344219

    VMware.VimAutomation.Vmc            10.0.0.7893902

    VMware.VimAutomation.vROps          10.0.0.7893921

    VMware.VumAutomation                6.5.1.7862888

    VMware.DeployAutomation             6.7.0.8250345

    VMware.ImageBuilder                 6.7.0.8250345

    VMware.PowerCLI                     10.1.0.8403314

    VMware.Vim                          6.7.0.8343295

    VMware.VimAutomation.Cis.Core       10.1.0.8377811

    VMware.VimAutomation.Cloud          10.0.0.7893901

    VMware.VimAutomation.Common         10.1.0.8342134

    VMware.VimAutomation.Core           10.1.0.8344055

    VMware.VimAutomation.HA             6.5.4.7567193

    VMware.VimAutomation.HorizonView    7.1.0.7547311

    VMware.VimAutomation.License        10.0.0.7893904

    VMware.VimAutomation.Nsxt           10.1.0.8346947

    VMware.VimAutomation.PCloud         10.0.0.7893924

    VMware.VimAutomation.Sdk            10.1.0.8342078

    VMware.VimAutomation.Srm            10.0.0.7893900

    VMware.VimAutomation.Storage        10.1.0.8313015

    VMware.VimAutomation.StorageUtility 1.2.0.0

    VMware.VimAutomation.Vds            10.1.0.8344219

    VMware.VimAutomation.Vmc            10.0.0.7893902

    VMware.VimAutomation.vROps          10.0.0.7893921

    VMware.VumAutomation                6.5.1.7862888



  • 6.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 07:02 PM

    Looks like you have PowerCLI installed in 2 locations.

    Possible in the C:\Program Files\WindowsPowerShell\Modules and C:\Users\<your-account>\Documents\WindowsPowerShell\Modules

    Can you do

    Get-Module -Name VMware* -ListAvailable


  • 7.  RE: Scripts Failing Suddenly

    Posted Jul 09, 2018 09:08 PM

    You are correct, 2 locations.  How can I correct this?



  • 8.  RE: Scripts Failing Suddenly

    Posted Jul 10, 2018 04:32 AM

    In the output from Get-Module -Name VMware* -ListAvailable, you'll see the directories into which the modules are installed.

    You can just delete the module folders in one of those directories.



  • 9.  RE: Scripts Failing Suddenly

    Posted Jul 10, 2018 02:16 PM

    I deleted the directory and no change :/



  • 10.  RE: Scripts Failing Suddenly

    Posted Jul 10, 2018 03:40 PM

    Next step, delete all the PowerCLI directories and do the Install-Module again.

    I suspect your installation might have an issue.



  • 11.  RE: Scripts Failing Suddenly

    Posted Jul 10, 2018 06:57 PM

    Did that, same result. :/



  • 12.  RE: Scripts Failing Suddenly

    Posted Jul 10, 2018 08:54 PM

    Very strange.
    Do you by any chance have another station where you can have PowerCLI installed?

    Does that show the same behaviour?



  • 13.  RE: Scripts Failing Suddenly

    Posted Jul 11, 2018 04:39 PM

    Ran it from my local machine and got the same error.



  • 14.  RE: Scripts Failing Suddenly

    Posted Jul 11, 2018 05:04 PM

    Both machines have the same OS?

    Same patch level?



  • 15.  RE: Scripts Failing Suddenly

    Posted Jul 12, 2018 01:39 PM

    Nope, one is a win16 server other is my laptop with windows 10



  • 16.  RE: Scripts Failing Suddenly

    Posted Jul 12, 2018 04:23 PM

    I'm a bit out of ideas, perhaps you should consider opening a SR for this.

    And yes, you can open a SR for PowerCLI, see PowerCLI Support Breakdown



  • 17.  RE: Scripts Failing Suddenly

    Posted Jul 16, 2018 07:13 PM

    This is becoming a real mystery :smileygrin:

    Can you check in the vpxd logs if there are any entries created at the time you get the error?



  • 18.  RE: Scripts Failing Suddenly

    Posted Jul 16, 2018 08:50 PM

    I don't see anything in the logs



  • 19.  RE: Scripts Failing Suddenly

    Posted Jul 12, 2018 07:19 PM

    I ran the script on a 2008 R2 server, and it seemed to run fine. It errored out on no FTP server, but the HTML page created fine.
    Can you run it without that cred file?
    Can the system be restored to a time when you know the script was running?



  • 20.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 04:36 PM

    I did remove the .xml file and still no success.  I am wondering if I installed powercli wrong, I must admit I really struggled when the simple install file method was removed and the sleek update/install method was put in place.  I just feel old and dumb for not getting it.



  • 21.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 05:13 PM

    Did you use Install-Module or Save-Module?

    Did you follow the instructions in Welcome PowerCLI to the PowerShell Gallery – Install Process Updates

    Are you using any VICredentialStoreItem cmdlets?



  • 22.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 06:44 PM

    I did the Install-Module and looked it over and seems to be same as what I did. I am not using that command in my scripts.



  • 23.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 06:47 PM

    Can you just start a PowerShell prompt, and do the Connect-VIServer.

    Then from the prompt, just do a Get-VM.

    Does that generate the same error as you are seeing in your script?

    Do all cmdlets (for exmaple Get-VMHost, Get-Datastore, Get-Cluster...) come back with the same error?



  • 24.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 07:46 PM

    Alright did just that and everything worked, BUT get-vm....same error



  • 25.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 08:01 PM

    Do you by any chance have a Hyper-V module installed?

    Can you do

    Get-Command -Name Get-VM



  • 26.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 08:13 PM

    PS C:\> Get-Command -Name Get-VM

    CommandType     Name                                               Version    Source

    -----------     ----                                               -------    ------

    Cmdlet          Get-VM                                             10.1.0.... VMware.VimAutomation.Core

    PS C:\> get-vm

    get-vm : 7/13/2018 3:12:37 PM   Get-VM          Value cannot be null.

    Parameter name: array

    At line:1 char:1

    + get-vm

    + ~~~~~~

        + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException

        + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM



  • 27.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 08:53 PM

    Clutching at straws now :smileygrin:

    Do you have anything in $PSDefaultParameterValues



  • 28.  RE: Scripts Failing Suddenly

    Posted Jul 13, 2018 09:01 PM

    And while you're at it, can you also try

    Get-VM -ErrorAction SilentlyContinue



  • 29.  RE: Scripts Failing Suddenly

    Posted Jul 16, 2018 03:22 PM

    I don't believe there is anything in the default configs, and that command comes back with nothing, no error no data.



  • 30.  RE: Scripts Failing Suddenly

    Posted Jul 17, 2018 08:24 AM

    Hi

    just had the same issue, strangely just on 1 of 4 vCenters, the other VCs correctly returned all VMs.

    After some testing i found, that a running VM clone task was interrupting the command. After the task is completed, everything works as expected.

    Just did a clone in our Lab-vCenter and same error occurs while the task is running.

    So check your running tasks



  • 31.  RE: Scripts Failing Suddenly

    Posted Jul 18, 2018 02:11 PM

    Don't think it is that, I am running them at two different times at night. Here is another thing that doesn't make sense, I have about half my scripts not working and half working just fine. Here is my script that discovers if VMTools are out of date and it works fine:

    #############################

    #    Connect to vCenter     #

    #############################

    Import-Module -Name VMware.PowerCLI

    Set-PowerCLIConfiguration -DisplayDeprecationWarnings $false -InvalidCertificateAction ignore -confirm:$false

    $vc = 'IP'

    $Cred = Import-Clixml C:\util\Scripts\creds\autoitjob2.xml

    Connect-VIServer $VC -Credential $Cred

    #############################

    #          Content          #

    #############################

    $date=Get-Date -format "yyyy-MMM-d"

    $datetime=Get-Date

    $filelocation="c:\util\Scripts\Temp\tools-$date.htm"

    $report = Get-View -ViewType VirtualMachine -Property Config.Template,Name,Guest.ToolsStatus -Filter @{"Config.Template"="False";"Guest.ToolsStatus"="^(?!toolsOk$).*$" ;"Name"="^((?!_replica).)*$"; "Runtime.PowerState"="poweredOn"} |

    Select-Object Name,@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}}

    #############################

    # Add Text to the HTML file #

    #############################

    $report | ConvertTo-Html –title "VMware VMTools Check" –body "<H1>VMware VMTools Check</H1>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File $filelocation

    ConvertTo-Html –title "VMware VMTools Check" –body "<H4>Date and time</H4>",$datetime -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

    ConvertTo-Html –title "VMware VMTools Check" –body "<H4>VM Count</H4>",$report.Count -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

    ######################

    # FTP HTML output #

    #####################

    #we specify the directory where all files that we want to upload 

    $Dir="$filelocation"

    #Below for test

    #$Dir="C:/Users/administrator/Desktop/tmp/"   

    #ftp server

    $ftp = "ftp://10.10.25.240/internal-backups/datacenter/vcenter/misc-reports/Tools/"

    $user = "IP"

    $pass = "PW" 

    $webclient = New-Object System.Net.WebClient

    $webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)

    #list every sql server trace file

    foreach($item in (dir $Dir "*.bak")){

        "Uploading $item..."

        $uri = New-Object System.Uri($ftp+$item.Name)

        $webclient.UploadFile($uri, $item.FullName)

    }

    ##############################

    # Disconnect session from VC #

    ##############################

    disconnect-viserver -confirm:$false



  • 32.  RE: Scripts Failing Suddenly

    Posted Jul 18, 2018 08:15 PM

    Are it only the scripts that contain a Get-VM that fail?

    And all with that same message?



  • 33.  RE: Scripts Failing Suddenly

    Posted Jul 18, 2018 08:51 PM

    Seems that is correct



  • 34.  RE: Scripts Failing Suddenly

    Posted Jul 18, 2018 09:31 PM

    Can you check if the following also gets the error?

    Get-VM -Name *

    And what about this one?

    Get-View -ViewType VirtualMachine



  • 35.  RE: Scripts Failing Suddenly

    Posted Jul 18, 2018 09:34 PM

    Btw, I found a rather old mention of exactly the same issue.

    See Strange PowerCLI Problem with Get-VM

    Unfortunately there is no solution present in the thread.

    The initial analysis in that thread is quite interesting, the user tried to link the issue to a specific VM or a specific VMHost.

    But it was not clear which of the 2 was actually causing the issue.



  • 36.  RE: Scripts Failing Suddenly

    Posted Jul 19, 2018 09:20 PM

    Chiming in with what info I have... I am having the same issue.

    Environment 1: Windows 2012 STD server

    $PSVersionTable

    Name                           Value

    ----                           -----

    PSVersion                      5.1.14409.1012

    PSEdition                      Desktop

    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

    BuildVersion                   10.0.14409.1012

    CLRVersion                     4.0.30319.42000

    WSManStackVersion              3.0

    PSRemotingProtocolVersion      2.3

    SerializationVersion           1.1.0.1

    Get-PowerCLIVersion

    PowerCLI Version

    ----------------

       VMware PowerCLI 6.5.1 build 5377412

    ---------------

    Component Versions

    ---------------

       VMware Cis Core PowerCLI Component 6.5 build 6230110

       VMware VimAutomation Core PowerCLI Component 6.5 build 6234650

    Environment 2: Windows 2012 R2 STD

    $PSVersionTable

    Name                           Value

    ----                           -----

    PSVersion                      5.1.14409.1012

    PSEdition                      Desktop

    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

    BuildVersion                   10.0.14409.1012

    CLRVersion                     4.0.30319.42000

    WSManStackVersion              3.0

    PSRemotingProtocolVersion      2.3

    SerializationVersion           1.1.0.1

    Get-PowerCLIVersion

    PowerCLI Version

    ----------------

       VMware PowerCLI 10.1.0 build 8346946

    ---------------

    Component Versions

    ---------------

       VMware Cis Core PowerCLI Component PowerCLI Component 10.1 build 8377811

       VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 10.1 build 8344055

    ----

    - Environment 1 works just fine, across 3 different vcenters (older version of powercli obviously).

    - Environment 2 works on 2 out of the 3 vcenters I have (newer version of powercli).

    - Curiously, installing the older version of powercli (6.5.1, same as on environment 1) yielded the same results on Environment 2.

    I was wondering about a corrupt powercli installation as well because the version number doesn't match with what shows on the PSGallery (10.1.1.8827524), even with using -AllowPrelease or -RequiredVersion. I've reinstalled probably about 10 times now.



  • 37.  RE: Scripts Failing Suddenly

    Posted Jul 19, 2018 10:57 PM

    The version on the PowerShell Gallery is indeed the latest.

    The difference between 10.1.0.8403314 and 10.1.1.8827524, is a newer version of the HorizonView module.

    See this list from a station that has both releases.

    PS C:\> Get-Module -Name VMware* -ListAvailable | Select Name,Version

    Name                                Version      

    ----                                -------      

    VMware.Hv.Helper                    1.1          

    VMware.DeployAutomation             6.7.0.8250345

    VMware.ImageBuilder                 6.7.0.8250345

    VMware.PowerCLI                     10.1.1.8827524

    VMware.PowerCLI                     10.1.0.8403314

    VMware.Vim                          6.7.0.8343295

    VMware.VimAutomation.Cis.Core       10.1.0.8377811

    VMware.VimAutomation.Cloud          10.0.0.7893901

    VMware.VimAutomation.Common         10.1.0.8342134

    VMware.VimAutomation.Core           10.1.0.8344055

    VMware.VimAutomation.HA             6.5.4.7567193

    VMware.VimAutomation.HorizonView    7.5.0.8827468

    VMware.VimAutomation.HorizonView    7.1.0.7547311

    VMware.VimAutomation.License        10.0.0.7893904

    VMware.VimAutomation.Nsxt           10.1.0.8346947

    VMware.VimAutomation.PCloud         10.0.0.7893924

    VMware.VimAutomation.Sdk            10.1.0.8342078

    VMware.VimAutomation.Srm            10.0.0.7893900

    VMware.VimAutomation.Storage        10.1.0.8313015

    VMware.VimAutomation.StorageUtility 1.2.0.0      

    VMware.VimAutomation.Vds            10.1.0.8344219

    VMware.VimAutomation.Vmc            10.0.0.7893902

    VMware.VimAutomation.vROps          10.0.0.7893921

    VMware.VumAutomation                6.5.1.7862888

    Try doing an Update-Module -Name VMware.PowerCLI to get the latest.

    Since you have 2 platforms that behave differently, it might be interesting to check which .Net versions you have on both.
    Can you run the following to determine the versions?

    Code comes from PowerShell script to return versions of .NET Framework on a machine? - Stack Overflow

    $Lookup = @{

       378389 = [version]'4.5'

       378675 = [version]'4.5.1'

       378758 = [version]'4.5.1'

       379893 = [version]'4.5.2'

       393295 = [version]'4.6'

       393297 = [version]'4.6'

       394254 = [version]'4.6.1'

       394271 = [version]'4.6.1'

       394802 = [version]'4.6.2'

       394806 = [version]'4.6.2'

       460798 = [version]'4.7'

       460805 = [version]'4.7'

       461308 = [version]'4.7.1'

       461310 = [version]'4.7.1'

       461808 = [version]'4.7.2'

       461814 = [version]'4.7.2'

    }


    Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |

       Get-ItemProperty -name Version, Release -EA 0 |

       # For One True framework (latest .NET 4x), change match to PSChildName -eq "Full":

    Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} |

       Select-Object @{name = ".NET Framework"; expression = {$_.PSChildName}},

    @{name = "Product"; expression = {$Lookup[$_.Release]}},

    Version, Release



  • 38.  RE: Scripts Failing Suddenly

    Posted Jul 20, 2018 04:31 PM

    Ok here's the results:

    Worked = Get-VM -Name *

    Worked = Get-View -ViewType VirtualMachine

    Failed = Get-VM | where { $_.Version -notmatch "v13" } | Select Name, Version

    I also ran the Update-Module -Name VMware.PowerCLI, went through the process and failed



  • 39.  RE: Scripts Failing Suddenly

    Posted Jul 20, 2018 04:46 PM

    Did you check the .Net versions?

    Are there perhaps any .Net related updates pending?



  • 40.  RE: Scripts Failing Suddenly

    Posted Jul 20, 2018 07:51 PM

    Sorry forgot that, here is the output:

    PSChildName Version   Release

    ----------- -------   -------

    Client      4.7.02053  460805

    Full        4.7.02053  460805

    Client      4.0.0.0



  • 41.  RE: Scripts Failing Suddenly

    Posted Jul 20, 2018 08:58 PM

    Seem to be good, dead end.



  • 42.  RE: Scripts Failing Suddenly

    Posted Jul 26, 2018 03:39 PM

    What would be the best/cleanest method to uninstall powercli completely and reinstall?



  • 43.  RE: Scripts Failing Suddenly

    Posted Jul 26, 2018 05:21 PM

    If you still have an entry in Programs and Features (from a MSI install), uninstall it.

    Then manually delete all VMware PowerCLI related folders in the different Modules folders.

    To check which ones those are, check the content of $env:PSModulePath.

    You can also check by listing all the PowerCLI modules like this

    Get-Module -Name Vmware* -ListAvailable

    Finally, just for good luck, reboot your PC.

    Then install again with

    Install-Module -Name VMware.PowerCLI



  • 44.  RE: Scripts Failing Suddenly

    Posted Jul 27, 2018 02:21 PM

    Did a full uninstall/reinstall and still no go.  I am wondering if its the vcenter itself as the clients have so little in common.



  • 45.  RE: Scripts Failing Suddenly
    Best Answer

    Posted Jul 27, 2018 02:30 PM

    Since you confirmed you had the same issue on multiple stations, it seems indeed to be linked to that as well.
    You sure there no VM with a funny name on that vCenter?
    Or ghosted entry?



  • 46.  RE: Scripts Failing Suddenly

    Posted Jul 27, 2018 02:31 PM

    Ghosted entry? What would that be?



  • 47.  RE: Scripts Failing Suddenly

    Posted Jul 30, 2018 01:42 PM

    I found that there was an invalid VM hanging out after some testing went south.  I erased it and now I have scripts running again.

    Thanks again for hanging with me on this!!



  • 48.  RE: Scripts Failing Suddenly

    Posted Jul 30, 2018 03:46 PM

    You're welcome.
    It was an intriguing issue :smileygrin:



  • 49.  RE: Scripts Failing Suddenly

    Posted Jul 30, 2018 06:14 PM

    I couldn't find any 'invalid' VMs in my vcenter, however I do have some 'inaccessible' VMs, and a few hosts that I found out have expired licenses. It will take me a while to get some licenses for the hosts but I'll update if that (or removing the inaccessible vms) fixes my issue.



  • 50.  RE: Scripts Failing Suddenly

    Posted Aug 01, 2018 02:11 PM

    @nilly, my VM was considered invalid so I feel that is the cause for you, but hey every case is different.

    @LucD, lol glad to see I can still intrigue a master like you! :smileysilly:



  • 51.  RE: Scripts Failing Suddenly

    Posted Aug 01, 2018 03:25 PM

    I think there should be kind of a validity check available on the vCenter DB.
    Not sure if that exists, but I'm not aware there is such a check.