Quantcast
Channel: VMware Communities : Discussion List - VMware PowerCLI
Viewing all 14549 articles
Browse latest View live

New-VICredentialStoreItem related question

$
0
0

hello

 

New-VICredentialStoreItem -Host vCenterServer01 -User JColeman -Password ((get-credential).GetNetworkCredential().password)

 

 

this is nice way to store info without typing passwd

 

issue

 

1. i am in windows10 laptop in domain x

2. vcenter is in AD domain y

3. my username & passwd of domain y i need to use from laptop connected to domain X, how can i use this cmd  in such case ?

 

 

Note : my laptop is not joined to domain Y.

 

thx


When using PowerCLI Command (Get-Tag) which uses VMware Lookup service you see this error: there was no endpoint listening

$
0
0

Get-Tag : 3/15/2018 5:55:27 AM    Get-Tag        There was no endpoint listening at

https://tavc.itislab.com/lookupservice/sdk that could accept the message. This is often caused by an incorrect address

or SOAP action. See InnerException, if present, for more details.

At line:1 char:1

+ Get-Tag

+ ~~~~~~~

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

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Tagging.GetTag

 

Hello All,

 

This is the issue being faced, where I am trying to automate, using Powercli command.

 

If someone, can please help me find a solution or link to follow the document, would be a great help.

 

Regards,

Suhail

Recompose Horizon Desktop Pools via PowerCLI

$
0
0

I have been trying to find a way to recompose our VDI Pools via PowerCli and find only references to old deprecated PowerCli commands.

 

Does anyone know how to kick off a recompose with the current version of PowerCli?

how to get host memory used per vm?

$
0
0

I found the commands to get allocated memory and cpu per vm but would like to collect what each vm is actually using. 

PowerCLI guest os version

$
0
0

I am trying to get the CentOS Version by PowerCLI.

 

I am using this cmdlt:

Get-VM | Select-Object @{N="Name";E={$_.Guest.VM}},@{N="OS";E={$_.Guest.OSFullName}} | Format-Table

 

It works perfect for Windows Server, but CentOS Server shows 「CentOS 4/5/6/7 (64bit)」

I want to have which version the CentOS is running on.

 

Does anyone know how to do it or if it is even possible...

VMkernel creation with TCP/IP stack

$
0
0

Hello,

 

I am trying to create VMkernels with TCP/IP stack 'vmotion' but I do not see anywhere it is feasible.

 

Does anybody know?

 

Thanks

 

Fred

Can someone help me with formatting the output of this script into an easily readable CSV?

$
0
0

Can someone help me with formatting the output of this script into an easily readable CSV?

 

Import-Module VMware.VimAutomation.Core

Import-Module VMware.VimAutomation.VDS

Connect-VIServer -Server X.X.X.X -Protocol https -User administrator@vsphere.local -Password password

$VMhosts = Get-VMHost

$hosts = $VMhosts.Name

 

 

foreach($i in $hosts){

echo $i

$esxcli = Get-EsxCli -VMHost $i

$x=$Esxcli.network.nic.list() | Select-Object *, @{N="FirmwareVersion"; E={$Esxcli.network.nic.get($_.name).driverinfo.firmwareVersion}}, @{N="Version"; E={$Esxcli.network.nic.get($_.name).driverinfo.Version}}

$y = $esxcli.software.vib.list() | Where-Object {$_.ID -Like "*ixgbe*"}

echo $y | Select-Object -Property ID

echo $x | Select-Object -Property Name,Version

}

Exporting Tags to .CSV

$
0
0

Morning,

 

   We upgraded our server from VMware 5.5 to 6.5.  The script that we previously used to gather all the tag information worked until the upgrade to 6.5.  Here is the script:

 

Get-VM | Select Name,

@{N="Contact";E={((Get-TagAssignment -Entity $_ -Category Contact | select -ExpandProperty Tag).Name )}},

@{N="Purpose";E={((Get-TagAssignment -Entity $_ -Category Purpose | select -ExpandProperty Tag).Name )}},

@{N="Patch";E={((Get-TagAssignment -Entity $_ -Category Patch | select -ExpandProperty Tag).Name )}},

@{N="Lifecycle";E={((Get-TagAssignment -Entity $_ -Category Lifecycle | select -ExpandProperty Tag).Name )}},

@{N="Application";E={((Get-TagAssignment -Entity $_ -Category Application | select -ExpandProperty Tag).Name )}},

@{N="Platform";E={((Get-TagAssignment -Entity $_ -Category Platform | select -ExpandProperty Tag).Name )}},

@{N="PCI";E={((Get-TagAssignment -Entity $_ -Category PCI | select -ExpandProperty Tag).Name )}},

@{N="Environment";E={"Vmware Corp"}},

@{N="IP Address";E={@($_.Guest.IPAddress)}} |

ConvertTo-Csv -NoTypeInformation |

out-file "E:\Staging\ServerInventory\CSV\gswpvcnt001.csv"

 

The current issue is that all tag information cannot be pulled.  The only information that is gathered and exported to a .csv file is the name, environment and ip address.  No tagging information is provided. 


vCheck script with smtp authentication

$
0
0

Help!

I am trying to use the amazing vCheck script but to send an email I require an authentication setting and cannot figure out how to do this.

Thank you,
Andy

Same Tags in Multiple Categories

$
0
0
If I have a tag name that exists in multiple categories, how do I list the category of the tag which is assigned to a VM?

Script to install vm tools on a brand new vm

$
0
0

Hello,

 

I need a script to find the windows VM's without VM tools installed and install VM tools without rebooting a VM using PoweCLI or PowerShell.

 

Thanks,

Ganesh

Issues with Stop-VM

$
0
0

Hello,

 

I'm getting an error with the command Stop-VM.

 

This is the script i'm trying to run :

 

&{foreach($vm in Get-Folder "Sandbox" | Get-VM)

    {

        if ($vm.PowerState -eq "poweredOn"){

              $vm | Stop-VM -Kill -Confirm:$false

            }

    }

}

 

and here is the error i'm getting :

Stop-VM_Error.png

I get the same error with

 

&{foreach($vm in Get-Folder "Sandbox" | Get-VM)

    {

        if ($vm.PowerState -eq "poweredOn"){

                 Stop-VM -VM $vm.Name -Kill -Confirm:$false

            }

    }

}

 

For info I'm running this script from a VM (Ubuntu 16.04) and I'm using VMware.PowerCLI 10.0.0.7895300, Powershell v6.0.2 and a vCenter 5.5.

 

Thanks

PowerCLI 10 compatibility with PoshRSJob

$
0
0

Now that we have a new version of PowerCLI being developed, could I get some people behind me to try to get the developers to add compatibility for PowerCLI cmdlets with the PoshRSJob module? I have been struggling with this for about a year now, and I think this may be the opportunity to actually get it done. What is the formal process for submitting something like this to the devs? Any and all help is greatly appreciated.

 

Below is an example of my issue. I use the script below and get the following error from most jobs. It has something to do with the global DefaultVIServer and DefaultVIServers variables.

$vCenters = @(

"<vcenterservername1>"

"<vcenterservername2>"

)

 

Get-RSJob | Stop-RSJob | Remove-RSJob -Force

 

$Credential = Get-Credential

Connect-VIServer $vCenters -WarningAction SilentlyContinue -Credential $Credential -ErrorAction Stop | Out-Null

 

$VMHosts = $null

$VMHosts = Get-VMHost -ErrorAction Stop

 

Disconnect-VIServer * -Confirm:$false | Out-Null

 

$VMHosts | Start-RSJob -Name {$_} -Throttle 100 -ModulesToImport VMware.VimAutomation.Core -ScriptBlock {

 

    $VMHost = $_

   

    try {

 

        Connect-VIServer $Using:vCenters -WarningAction SilentlyContinue -Credential $Using:Credential -ErrorAction Stop | Out-Null

 

        $VMHostAuth = Get-VMHostAuthentication -VMHost $VMHost.Name -ErrorAction Stop

 

        [PSCustomObject][Ordered]@{

       

            VMHost = $VMHost.Name

            Status = "SUCCESS"

            Domain = $VMHostAuth.Domain

       

        }

 

    }

    catch {

   

        [PSCustomObject][Ordered]@{

       

            VMHost = $VMHost.Name

            Status = "FAILURE"

            Domain = $_.Exception.Message

       

        }

   

    }

 

    Disconnect-VIServer * -Confirm:$false | Out-Null

 

}

 

$Results = Get-RSJob | Wait-RSJob | Receive-RSJob

$Results | ogv

 

Below is the error that I receive from most jobs:

Disconnect-VIServer : You have  modified the global:DefaultVIServer and global:DefaultVIServers system variables. This is not allowed. Please reset them to $null and reconnect to the vSphere server.

At H:\Scripts\PowerCLI\Jobs\JobTest.ps1:9 char:1

+ Disconnect-VIServer * -Confirm:$false -ErrorAction SilentlyContinue | ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Disconnect-VIServer], InvalidState

    + FullyQualifiedErrorId : VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.InvalidState,VMware.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer

powercli 10 connect-viserver error method not found

$
0
0

Hello,

 

I am having a bit of a challenge getting PowerCLI 10 to connect to my vCenter server (VCSA 6.0 U3). When I run the Connect-VIServer command I get the following error:

 

Connect-VIServer : Method not found: 'Void VMware.Binding.Sts.VmwareSecruityTokenService..ctor(System.Uri)'.

At line:1 char:1

+ Connect-VIServer vcsa6.corp.pep.tst

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], MissingMethodException

    + FullyQualifiedErrorId : System.MissingMethodException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServ

   er

 

I thought the error was due to an invalid certificate, but running Get-PowerCLIConfiguration you can see I have it set to ignore:

 

PS C:\> Get-PowerCLIConfiguration

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayDeprecationWarnings WebOperationTimeout
                                                                                                  Seconds
-----    -----------     ------------------- ------------------------  -------------------------- -------------------
Session  UseSystemProxy  Single              Ignore                    True                       300
User                     Single              Ignore
AllUsers                                     Ignore

 

 

The connect fails after I input my vCenter credentials using both AD credentials and SSO Administrator. What am I doing wrong?

 

Thanks in Advance!

 

 

invoke-vmscript powershell formatting isn't being passed through correctly

$
0
0

I feel daft for asking this as i'm pretty sure it's not a powercli problem but a me problem - yet i cannot figure it.

 

I basically i'm trying to get the uptime of every o/s (using the exsi info sys.uptime.latest proved a little inaccurate for our estate unfortunatley) . so i'm trying to pass through the command

 

(Date)-([Management.ManagementDateTimeConverter]::ToDateTime((gwmi Win32_OperatingSystem).LastBootUpTime)) to the invoke-vmscript.

 

it keeps telling me the input string is in the incorrect format, yet if i run it locally on any VM, it runs fine.  what on god's earth am i doing wrong to make powercli pass it through incorrectly.

 

This is how the command is stored before it's invoked:

 

$InvokeScriptParam =@{

                        ScriptText = "(Date)-([Management.ManagementDateTimeConverter]::ToDateTime((gwmi Win32_OperatingSystem).LastBootUpTime))"

                        VM = $VM.Name

                        GuestCredential = $VMCredential

                        ErrorAction = "stop"

                        ScriptType = 'Powershell'

                         }

                 

on the flip side, when invoking the equivilent command on a linux machine via the above, formatting doesn't seem to be a problem and it reports back correctly.

 

cheers


Deploying an ovf from powercli without specifying a host via vcenter

$
0
0

Hi,

I can deploy an ovf from vcenter ui without having to specify a host. From the web ui I only need to specify a cluster. Is there a powercli equivalent to do the same? I tried import-vapp however that requires vmhost (mandatory) to be specified. I want vcenter to choose a host without me needing to specify a host. Am I using the wrong powercli api or is this possible from powercli? I am using powercli 10.0.

RVTools - missing Network and Switch name in case of our newest Datacenter

$
0
0

Hi,

 

We have a new Datacenter under our vCenter with 6 new hosts. I have been using RVTools for a while, and i noticed now that in case of the new datacenter, the Network and Switch names are  missing in the vNetwork table.

 

What could be the problem?

rvtools.png

There is an error in XML document

$
0
0

Dear Team,

 

 

Most of the time i'm getting below error , don't what what mistake i'm doing kindly assist me on the same

 

 

if I run below command at that time also i'm getting same error.

 

Get-HardDisk VMName | Where-Object {$_.Name -eq “Hard Disk 2”} | Set-HardDisk -CapacityGB 10 -Confirm:$false

vCheck and storing credentials for scheduled task

$
0
0

I'm trying to setup vCheck as a scheduled task but it keeps prompting for credentials when running as a batch file.

 

I've added the credential using the following command.

 

New-VICredentialStoreItem-Hostmyvc-User administrator@vsphere.local-Passwordpassword - File c:\scripts\vcpwd.xml

 

In the connection plugin for vcenter, I've added the following lines to pull the credentials but it's not working. Am I missing further steps here or what is the cause?

 

$Credfile = "C:\scripts\vcpwd.xml"

$Creds = Get-VICredentialStoreItem -Host $VIServer -File "C:\scripts\vcpwd.xml"

 

The .bat file string is as follows: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -File "C:\scripts\vCheck-vSphere-master\vCheck.ps1

Datastore Report (CSV)

$
0
0

Hey guys,

 

Looking for help from a PowerCLI master...

 

I would like a script that would list all datastores for multiples vCenters in a csv format.

 

The columns would be Datastore Name, Capacity (GB), Provisionned Space (GB), Free Space (GB), Free Space (%), Host, Cluster, vCenter

 

I found one that exports it in HTML that is pretty good but I would like to have it in a CSV.

(Script Get DataStore Usage Report on email. )

Let me know if you can help me!

 

Thanks!

Viewing all 14549 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>