<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Fixing a (minor) PowerCLI 6 R1 issue	</title>
	<atom:link href="https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 28 Sep 2016 19:37:36 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>
		By: Willian Lanzelotti		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-4109</link>

		<dc:creator><![CDATA[Willian Lanzelotti]]></dc:creator>
		<pubDate>Wed, 28 Sep 2016 19:37:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-4109</guid>

					<description><![CDATA[&lt;a href=&quot;#comment-3830&quot; rel=&quot;nofollow&quot;&gt;@LucD &lt;/a&gt; 
Thanks!!]]></description>
			<content:encoded><![CDATA[<p><a href="#comment-3830" rel="nofollow">@LucD </a><br />
Thanks!!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3972</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 06 Jul 2016 19:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3972</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3969&quot;&gt;Noel&lt;/a&gt;.

I suspect the issue is because the PowerCLI do not work with autoload.
You have to load them explicitly, and the PSSnapin as well. That was one of the reasons I wrote my &lt;a href=&quot;https://www.lucd.info/2016/05/05/universal-powercli-loader/&quot;&gt;Enable-PowerCLI&lt;/a&gt; function.
Can you try with the function, just call it in the beginning of your script.]]></description>
			<content:encoded><![CDATA[<p>I suspect the issue is because the PowerCLI do not work with autoload.<br />
You have to load them explicitly, and the PSSnapin as well. That was one of the reasons I wrote my <a href="https://www.lucd.info/2016/05/05/universal-powercli-loader/">Enable-PowerCLI</a> function.<br />
Can you try with the function, just call it in the beginning of your script.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Noel		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3969</link>

		<dc:creator><![CDATA[Noel]]></dc:creator>
		<pubDate>Tue, 05 Jul 2016 09:32:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3969</guid>

					<description><![CDATA[&lt;a href=&quot;#comment-3830&quot; rel=&quot;nofollow&quot;&gt;@LucD &lt;/a&gt; 

Hi, 

I tried uninstalling PowerCLI-6.3.0-3737840 and reinstalling again but I have the same problem. 

This is the command i run as administrator:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile &quot;C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1&quot; &quot; &#038;  &quot;C:\scripts\vcheck_vcenter\vCheck_atvcen8\vCheck-vSphere-master\vCheck.ps1&quot;

The output is as follows:

Get-VICredentialStoreItem : The term &#039;Get-VICredentialStoreItem&#039; is not
recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At C:\scripts\vcheck_vcenter\vCheck_atvcen8\vCheck-vSphere-master\Plugins\00
Initialize\00 Connection Plugin for vCenter.ps1:53 char:10
+ $Creds = Get-VICredentialStoreItem -Host $VIServer -File C:\credentia ...
+          ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-VICredentialStoreItem:Strin
   g) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException



This is how my psmodulepath looks ...

PS C:\Users\Administrator&#062; $env:psmodulepath
C:\Users\Administrator\Documents\WindowsPowerShell\Modules;
C:\Program Files\WindowsPowerShell\Modules;
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;
C:\Program Files\Hewlett-Packard\PowerShell\Modules;
C:\Program Files\EMC\EMC Storage Integrator\;
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules;
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules\;
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules\


And this vim.psc1 file in C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI




  1.0
  
    
    
  


and this is my powershell version

PS C:\Users\Administrator&#062; $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10514  6

Regards,

Noel]]></description>
			<content:encoded><![CDATA[<p><a href="#comment-3830" rel="nofollow">@LucD </a> </p>
<p>Hi, </p>
<p>I tried uninstalling PowerCLI-6.3.0-3737840 and reinstalling again but I have the same problem. </p>
<p>This is the command i run as administrator:</p>
<p>C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile &#8220;C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1&#8243; &#8221; &amp;  &#8220;C:\scripts\vcheck_vcenter\vCheck_atvcen8\vCheck-vSphere-master\vCheck.ps1&#8221;</p>
<p>The output is as follows:</p>
<p>Get-VICredentialStoreItem : The term &#8216;Get-VICredentialStoreItem&#8217; is not<br />
recognized as the name of a cmdlet, function, script file, or operable<br />
program. Check the spelling of the name, or if a path was included, verify<br />
that the path is correct and try again.<br />
At C:\scripts\vcheck_vcenter\vCheck_atvcen8\vCheck-vSphere-master\Plugins\00<br />
Initialize\00 Connection Plugin for vCenter.ps1:53 char:10<br />
+ $Creds = Get-VICredentialStoreItem -Host $VIServer -File C:\credentia &#8230;<br />
+          ~~~~~~~~~~~~~~~~~~~~~~~~~<br />
    + CategoryInfo          : ObjectNotFound: (Get-VICredentialStoreItem:Strin<br />
   g) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>This is how my psmodulepath looks &#8230;</p>
<p>PS C:\Users\Administrator&gt; $env:psmodulepath<br />
C:\Users\Administrator\Documents\WindowsPowerShell\Modules;<br />
C:\Program Files\WindowsPowerShell\Modules;<br />
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;<br />
C:\Program Files\Hewlett-Packard\PowerShell\Modules;<br />
C:\Program Files\EMC\EMC Storage Integrator\;<br />
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules;<br />
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules\;<br />
C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules\</p>
<p>And this vim.psc1 file in C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI</p>
<p>  1.0</p>
<p>and this is my powershell version</p>
<p>PS C:\Users\Administrator&gt; $PSVersionTable.PSVersion</p>
<p>Major  Minor  Build  Revision<br />
&#8212;&#8211;  &#8212;&#8211;  &#8212;&#8211;  &#8212;&#8212;&#8211;<br />
5      0      10514  6</p>
<p>Regards,</p>
<p>Noel</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3830</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Tue, 22 Mar 2016 19:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3830</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3829&quot;&gt;Luke&lt;/a&gt;.

This is different in 6.3R1.
Since 6R2 the $env:psmodulepath was doen correctly during the installation of PowerCLI.
What you are seeing is most probably caused by the difference in PSSnapin and Modules in PowerCLI.
I now use the following lines to load the PSSnapin and Modules.
&lt;code&gt;
$loaded = Get-Module -Name VMware* -ErrorAction SilentlyContinue &#124; where{$_.Name -notmatch &#039;Common$&#124;SDK$&#039;} &#124; Select Name
Get-Module -Name VMware* -ListAvailable &#124; where{$loaded -notcontains $_.Name} &#124; %{Import-Module -Name $_.Name}
    
$loadedSnap = Get-PSSnapin -Name VMware* -ErrorAction SilentlyContinue &#124; where{$_.Name -notmatch &#039;Core$&#039;} &#124; Select Name
Get-PSSnapin -Name VMware* -Registered &#124; where{$loadedSnap -notcontains $_.Name} &#124; %{Add-PSSnapin -Name $_.Name}
&lt;/code&gt;
Hope that helps.]]></description>
			<content:encoded><![CDATA[<p>This is different in 6.3R1.<br />
Since 6R2 the $env:psmodulepath was doen correctly during the installation of PowerCLI.<br />
What you are seeing is most probably caused by the difference in PSSnapin and Modules in PowerCLI.<br />
I now use the following lines to load the PSSnapin and Modules.<br />
<code><br />
$loaded = Get-Module -Name VMware* -ErrorAction SilentlyContinue | where{$_.Name -notmatch 'Common$|SDK$'} | Select Name<br />
Get-Module -Name VMware* -ListAvailable | where{$loaded -notcontains $_.Name} | %{Import-Module -Name $_.Name}</p>
<p>$loadedSnap = Get-PSSnapin -Name VMware* -ErrorAction SilentlyContinue | where{$_.Name -notmatch 'Core$'} | Select Name<br />
Get-PSSnapin -Name VMware* -Registered | where{$loadedSnap -notcontains $_.Name} | %{Add-PSSnapin -Name $_.Name}<br />
</code><br />
Hope that helps.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Luke		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3829</link>

		<dc:creator><![CDATA[Luke]]></dc:creator>
		<pubDate>Tue, 22 Mar 2016 04:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3829</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3771&quot;&gt;Jonas Jakobsen&lt;/a&gt;.

I am having this same issue with 6.3 R1 as well.
None of my batch files that were created to run scheduled tasks will run now. When trying to use the Get-PowerCLIVersion test as outlined about, i get the error: 
C:\Users\username_admin&#062;powershell.exe -psc &quot;D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1&quot; -noprofile -command &quot;Get-PowerCLIVersion&quot;

Get-PowerCLIVersion : The term &#039;Get-PowerCLIVersion&#039; is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ Get-PowerCLIVersion
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-PowerCLIVersion:String) [],
    CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I&#039;ve modified the vim.psc1 console file to include the line
 
because it seems that the only snap-ins that are included are VMware.DeployAutomation and VMware.ImageBuilder but even with that change i&#039;m not having any luck, but now get a different error:
C:\Users\username_admin&#062;powershell.exe -psc &quot;D:\Program Files (x86)\VMware\In
frastructure\vSphere PowerCLI\vim.psc1&quot; -noprofile -command &quot;Get-PowerCLIVersion&quot;

Windows PowerShell terminated with the following error:
 There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: Import-Module VMware.VimAutomation.Cis.Core]]></description>
			<content:encoded><![CDATA[<p>I am having this same issue with 6.3 R1 as well.<br />
None of my batch files that were created to run scheduled tasks will run now. When trying to use the Get-PowerCLIVersion test as outlined about, i get the error:<br />
C:\Users\username_admin&gt;powershell.exe -psc &#8220;D:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1&#8221; -noprofile -command &#8220;Get-PowerCLIVersion&#8221;</p>
<p>Get-PowerCLIVersion : The term &#8216;Get-PowerCLIVersion&#8217; is not recognized as the<br />
name of a cmdlet, function, script file, or operable program. Check the<br />
spelling of the name, or if a path was included, verify that the path is<br />
correct and try again.<br />
At line:1 char:1<br />
+ Get-PowerCLIVersion<br />
+ ~~~~~~~~~~~~~~~~~~~<br />
    + CategoryInfo          : ObjectNotFound: (Get-PowerCLIVersion:String) [],<br />
    CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>I&#8217;ve modified the vim.psc1 console file to include the line</p>
<p>because it seems that the only snap-ins that are included are VMware.DeployAutomation and VMware.ImageBuilder but even with that change i&#8217;m not having any luck, but now get a different error:<br />
C:\Users\username_admin&gt;powershell.exe -psc &#8220;D:\Program Files (x86)\VMware\In<br />
frastructure\vSphere PowerCLI\vim.psc1&#8221; -noprofile -command &#8220;Get-PowerCLIVersion&#8221;</p>
<p>Windows PowerShell terminated with the following error:<br />
 There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: Import-Module VMware.VimAutomation.Cis.Core</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonas Jakobsen		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3771</link>

		<dc:creator><![CDATA[Jonas Jakobsen]]></dc:creator>
		<pubDate>Tue, 26 Jan 2016 12:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3771</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3716&quot;&gt;LucD&lt;/a&gt;.

Hi Luc

I just upgraded from 5.8 R1 to first 6.0 R2 and then 6.0 R3 but this problem is haunting me :(

It seems like PSModulePath is correct both for my batch user and for machine. Running Get-Module -ListAvailable shows the modules but autoloading is not working. Running a powershell.exe with the vim.psc1 does not fix this - &quot;Connect-VIServer cmdlet not found&quot;.

One thing I noted is that running Get-Module -ListAvailable shows no exported commands for the VMware modules but for all other and if I read Microsoft Technet[1] correct this needs to be the case for autoloading to work otherwise get-command won&#039;t show them and this is necessary for autoloading to work.

Any ideas on what to look for?


[1] https://technet.microsoft.com/en-us/library/dd878284%28v=vs.85%29.aspx]]></description>
			<content:encoded><![CDATA[<p>Hi Luc</p>
<p>I just upgraded from 5.8 R1 to first 6.0 R2 and then 6.0 R3 but this problem is haunting me 🙁</p>
<p>It seems like PSModulePath is correct both for my batch user and for machine. Running Get-Module -ListAvailable shows the modules but autoloading is not working. Running a powershell.exe with the vim.psc1 does not fix this &#8211; &#8220;Connect-VIServer cmdlet not found&#8221;.</p>
<p>One thing I noted is that running Get-Module -ListAvailable shows no exported commands for the VMware modules but for all other and if I read Microsoft Technet[1] correct this needs to be the case for autoloading to work otherwise get-command won&#8217;t show them and this is necessary for autoloading to work.</p>
<p>Any ideas on what to look for?</p>
<p>[1] <a href="https://technet.microsoft.com/en-us/library/dd878284%28v=vs.85%29.aspx" rel="nofollow ugc">https://technet.microsoft.com/en-us/library/dd878284%28v=vs.85%29.aspx</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: LucD		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3716</link>

		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Fri, 04 Dec 2015 12:40:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3716</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3713&quot;&gt;Dingus McGee&lt;/a&gt;.

Hi, the fix is only valid for PowerCLI 6.0 R1.
If you have 6.0 R3, the problem is not there anymore.]]></description>
			<content:encoded><![CDATA[<p>Hi, the fix is only valid for PowerCLI 6.0 R1.<br />
If you have 6.0 R3, the problem is not there anymore.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dingus McGee		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3713</link>

		<dc:creator><![CDATA[Dingus McGee]]></dc:creator>
		<pubDate>Thu, 03 Dec 2015 22:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3713</guid>

					<description><![CDATA[Can you please post an example of what the vim.psc1 should look like after this script runs? I&#039;ve not been able to have success using the script, but want to manually modify the vim.psc1 to be able to run batch files via scheduled tasks using PowerCLI 6.0 R3. Thanks]]></description>
			<content:encoded><![CDATA[<p>Can you please post an example of what the vim.psc1 should look like after this script runs? I&#8217;ve not been able to have success using the script, but want to manually modify the vim.psc1 to be able to run batch files via scheduled tasks using PowerCLI 6.0 R3. Thanks</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Vandrey Trindade		</title>
		<link>https://www.lucd.info/2015/08/12/fixing-a-minor-powercli-6-r1-issue/#comment-3590</link>

		<dc:creator><![CDATA[Vandrey Trindade]]></dc:creator>
		<pubDate>Thu, 13 Aug 2015 18:24:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.lucd.info/?p=4896#comment-3590</guid>

					<description><![CDATA[I had this problem and didn&#039;t find nowhere an answer... So I edited the vim.psc1 myself to remove PSModules... Thanks for the script!]]></description>
			<content:encoded><![CDATA[<p>I had this problem and didn&#8217;t find nowhere an answer&#8230; So I edited the vim.psc1 myself to remove PSModules&#8230; Thanks for the script!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
