Yeah Hyper-V is there:
Get-Module -Name Hyper-V -ListAvailable
Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 2.0.0.0 Hyper-V {Add-VMAssignableDevice, Add-VMDvdDrive, Add-VMFibreChanne...
Binary 1.1 Hyper-V {Add-VMDvdDrive, Add-VMFibreChannelHba, Add-VMHardDiskDriv...
So I ran:
Install-Module -Name VMware.PowerCLI -Scope CurrentUser -AllowClobber -SkipPublisherCheck -Force -Verbose
Much more installed, not sure anything was missued:
https://pastebin.com/0fJ7Xdtq
Get-Module -Name VMware* -ListAvailable
Directory: C:\Users\admin.andy.white\Documents\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 12.5.0.... VMware.CloudServices {Connect-Vcs, Disconnect-Vcs, Get-VcsOrganizationRole, Get...
Script 7.0.3.1... VMware.DeployAutomation {Add-CustomCertificate, Add-DeployRule, Add-ProxyServer, A...
Script 7.0.3.1... VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Manifest 12.5.0.... VMware.PowerCLI
Script 12.5.0.... VMware.PowerCLI.Sdk
Script 12.5.0.... VMware.PowerCLI.Sdk.Types
Script 12.5.0.... VMware.PowerCLI.VCenter {Get-VIMachineCertificate, Get-VITrustedCertificate, Remov...
Script 12.5.0.... VMware.PowerCLI.VCenter.Types.Ap...
Script 12.5.0.... VMware.PowerCLI.VCenter.Types.Ce...
Script 1.0.106... VMware.Sdk.Runtime {Get-ServerConfiguration, New-ServerConfiguration, Add-Ser...
Manifest 1.0.104... VMware.Sdk.vSphere
Script 3.0.104... VMware.Sdk.vSphere.Appliance {Invoke-GetItemHealthMessages, Invoke-GetHealthSettings, I...
Script 2.0.104... VMware.Sdk.vSphere.Appliance.Access {Invoke-GetAccessConsolecli, Invoke-SetAccessConsolecli, I...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Health {Invoke-GetHealthApplmgmt, Invoke-GetHealthDatabase, Invok...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Inf... {Invoke-ExportInfraprofileConfigs, Invoke-ImportInfraprofi...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Loc... {Invoke-GetLocalAccountsGlobalPolicy, Invoke-SetLocalAccou...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Log... {Invoke-GetLoggingForwarding, Invoke-SetLoggingForwarding,...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Net... {Invoke-CreateNetworkingDnsDomains, Invoke-ListNetworkingD...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Rec... {Invoke-GetSystemNameArchive, Invoke-ListSystemNameArchive...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Sup... Invoke-GetSupportBundleComponents
Script 1.0.104... VMware.Sdk.vSphere.Appliance.System {Invoke-GetSystemGlobalFips, Invoke-SetSystemGlobalFips, I...
Script 1.0.104... VMware.Sdk.vSphere.Appliance.Update {Invoke-InstallVersionPending, Invoke-ListUpdatePending, I...
Script 1.0.104... VMware.Sdk.vSphere.Cis {Invoke-CreateSession, Invoke-DeleteSession, Invoke-GetSes...
Script 1.0.104... VMware.Sdk.vSphere.Cis.Tagging {Invoke-AddToUsedByCategoryId, Invoke-CreateCategory, Invo...
Script 1.0.104... VMware.Sdk.vSphere.Content {Invoke-GetContentConfiguration, Invoke-UpdateContentConfi...
Script 1.0.104... VMware.Sdk.vSphere.ContentLibrary {Invoke-GetLibraryItemVersionLibraryChanges, Invoke-ListLi...
Script 1.0.104... VMware.Sdk.vSphere.Esx.Hcl {Invoke-DownloadHclCompatibilityDataAsync, Invoke-GetHclCo...
Script 1.0.104... VMware.Sdk.vSphere.Esx.Hosts {Invoke-ListHostSoftwareInstalledComponents, Invoke-GetSof...
Script 1.0.104... VMware.Sdk.vSphere.Esx.Settings {Invoke-DeleteClusterDraftSoftwareAddOn, Invoke-GetCluster...
Script 1.0.104... VMware.Sdk.vSphere.VAPI.Metadata {Invoke-GetCliCommand, Invoke-GetCliCommandFingerprint, In...
Script 1.0.104... VMware.Sdk.vSphere.vCenter {Invoke-GetCluster, Invoke-ListCluster, Invoke-CreateDatac...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Authe... Invoke-CreateAuthenticationToken
Script 1.0.104... VMware.Sdk.vSphere.vCenter.CertM... {Invoke-GetCertificateManagementSigningCertificate, Invoke...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Content {Invoke-CreateContentRegistriesHarbor, Invoke-DeleteRegist...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Datas... Invoke-GetDatastoreDefaultPolicy
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Deplo... {Invoke-CheckMigrateActiveDirectory, Invoke-CancelDeployme...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Guest {Invoke-CreateGuestCustomizationSpecs, Invoke-DeleteNameGu...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Identity {Invoke-CreateIdentityProviders, Invoke-DeleteProviderIden...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Inven... {Invoke-GetInventoryDatastore, Invoke-GetInventoryNetwork}
Script 1.0.104... VMware.Sdk.vSphere.vCenter.ISO {Invoke-MountIsoImage, Invoke-UnmountIsoImage, Initialize-...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.LCM {Invoke-CreateLcmDiscoveryAssociatedProducts, Invoke-Delet...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Names... {Invoke-ListNamespaceManagementSoftwareClusterAvailableVer...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Names... {Invoke-CreateNamespaceDomainSubjectAccess, Invoke-DeleteN...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.OVF {Invoke-ListOvfExportFlag, Invoke-ListOvfImportFlag, Invok...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Services {Invoke-GetService, Invoke-GetServices, Invoke-RestartServ...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Storage {Invoke-ListPoliciesEntitiesCompliance, Invoke-CheckCompat...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Syste... {Invoke-GetSystemConfigDeploymentType, Invoke-SetSystemCon...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Tagging Invoke-ListAssociations
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Topology {Invoke-GetNodeTopology, Invoke-ListTopologyNodes, Invoke-...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Trust... {Invoke-CreateTrustedInfrastructureTrustAuthorityHostsAtte...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.VCHA {Invoke-GetClusterActive, Invoke-DeployVchaClusterAsync, I...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.Vm {Invoke-GetVmHardwareBoot, Invoke-UpdateVmHardwareBoot, In...
Script 1.0.104... VMware.Sdk.vSphere.vCenter.VmTem... {Invoke-CheckInTemplateLibraryItemVmCheckOuts, Invoke-Chec...
Script 1.0.104... VMware.Sdk.vSphere.vStats {Invoke-CreateStatsAcqSpecs, Invoke-DeleteIdStatsAcqSpecs,...
Script 1.0.104... VMware.Sdk.vSphereRuntime {New-vSphereServerConfiguration, Get-vSphereServerConfigur...
Script 7.0.3.1... VMware.Vim
Script 12.5.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 12.0.0.... VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script 12.5.0.... VMware.VimAutomation.Common {Get-PowerCLIContext, Get-Task, New-OAuthSecurityContext, ...
Script 12.5.0.... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script 12.5.0.... VMware.VimAutomation.Hcx {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance...
Script 12.5.0.... VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Script 12.0.0.... VMware.VimAutomation.License Get-LicenseDataManager
Script 12.5.0.... VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtGlobal...
Script 12.5.0.... VMware.VimAutomation.Sdk Get-ErrorReport
Script 12.3.0.... VMware.VimAutomation.Security {Add-AttestationServiceInfo, Add-KeyProviderServiceInfo, A...
Script 12.3.0.... VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Script 12.5.0.... VMware.VimAutomation.Storage {Add-EntityDefaultKeyProvider, Add-KeyManagementServer, Ad...
Script 1.6.0.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script 12.5.0.... VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Script 12.5.0.... VMware.VimAutomation.Vmc {Add-VmcSddcHost, Connect-Vmc, Disconnect-Vmc, Get-AwsAcco...
Script 12.5.0.... VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...
Script 12.4.0.... VMware.VimAutomation.WorkloadMan... {Disable-WMCluster, Enable-WMCluster, Get-WMCluster, Get-W...
Script 12.1.0.... VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...
So if I run my ps script in ISE it runs.
If I open CMD and run this it works:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main.ps1
If I put the above into Windows Scheduler it fails:
To disable this warning and set your preference use the following command and restart PowerShell:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true or $false.
Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the
module could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.
At C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main.ps1:11 char:1
+ Connect-VIServer -Server vvsupport1.thisisglobal.com -Credential $cre ...
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Get-Cluster : The 'Get-Cluster' command was found in the module 'VMware.VimAutomation.Core', but the module could
not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.
At C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main.ps1:14 char:20
+ ClusterName = (Get-Cluster -Name 'London')
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Cluster:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Write-Influx : Cannot bind argument to parameter 'Metrics' because it is null.
At C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main.ps1:22 char:73
+ ... re LonClusterSpaceGB -Tags @{host="London"} -Metrics $Metrics -Databa ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Write-Influx], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Write-Influx
If I try using my service account and not my domain admin account, which is a local admin and in the local policy to run batch jobs:
runas /user:mydomain\svc-vmware powershell
Then I get this:
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run
C:\Users\svc.vmwareinfo\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\VMware.VimAutomation.Common.psm
1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): q
PS C:\Windows\system32> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main_svcaccount.ps1
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run
C:\Users\svc-vmware\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\VMware.VimAutomation.Common.psm
1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
If I keep type 'R' then some work some error:
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run C:\Users\svc-vmware\Documents\WindowsPowerShell\Modules\VMware.Vim\VMware.Vim.psm1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): R
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run
C:\Users\svc-vmware\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cis.Core\VMware.VimAutomation.Cis.Core
.psm1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): R
Connect-VIServer : The 'Connect-VIServer' command was found in the module 'VMware.VimAutomation.Core', but the module
could not be loaded. For more information, run 'Import-Module VMware.VimAutomation.Core'.
At C:\Scripts\VMware\DatastoreCluster_2_Influx_all_main_svcaccount.ps1:11 char:1
+ Connect-VIServer -Server vvsupport1.thisisglobal.com -Credential $cre ...
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-VIServer:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your
computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning
message. Do you want to run
C:\Users\svc-vmware\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Core\VMware.VimAutomation.Core.psm1?