<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Calling PowerCLI script from a batch file in VMware PowerCLI Documents</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/ta-p/2792335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am fairly new to using PowerCLI,&amp;nbsp; but have already seen the benefits of using it to help manage and administer a large infrastructure,&amp;nbsp; we have about 50 hosts using esx4i,&amp;nbsp; and it has been very useful.&amp;nbsp; I have a problem though in trying to run a health check,&amp;nbsp; I want to create a batch file that calls a .ps1 script and then schedule it as a task...&amp;nbsp; However,&amp;nbsp; here is the batch file code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&amp;amp;{c:\scripts\myscript.ps1}"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it comes up with this in the cmd prompt after running the batch file :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please specify a VI Server name eg....&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; powershell.exe vCheck.ps1 MyvCenter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I have the Connect-Viserver connection code in the myscript.ps1 ... The script runs great from PowerCLI ,&amp;nbsp; does anyone know what I am missing ?&amp;nbsp; Thanks for your help....any input would be appreciated.&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2011 14:33:39 GMT</pubDate>
    <dc:creator>ccatano2000</dc:creator>
    <dc:date>2011-05-06T14:33:39Z</dc:date>
    <item>
      <title>Calling PowerCLI script from a batch file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/ta-p/2792335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am fairly new to using PowerCLI,&amp;nbsp; but have already seen the benefits of using it to help manage and administer a large infrastructure,&amp;nbsp; we have about 50 hosts using esx4i,&amp;nbsp; and it has been very useful.&amp;nbsp; I have a problem though in trying to run a health check,&amp;nbsp; I want to create a batch file that calls a .ps1 script and then schedule it as a task...&amp;nbsp; However,&amp;nbsp; here is the batch file code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -command "&amp;amp;{c:\scripts\myscript.ps1}"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it comes up with this in the cmd prompt after running the batch file :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please specify a VI Server name eg....&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; powershell.exe vCheck.ps1 MyvCenter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I have the Connect-Viserver connection code in the myscript.ps1 ... The script runs great from PowerCLI ,&amp;nbsp; does anyone know what I am missing ?&amp;nbsp; Thanks for your help....any input would be appreciated.&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 14:33:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/ta-p/2792335</guid>
      <dc:creator>ccatano2000</dc:creator>
      <dc:date>2011-05-06T14:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling PowerCLI script from a batch file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/tac-p/2792336#M286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did u try executing same command manually from command prompt? if u still get same error then it may be some offending missed quote characters. make sure that if there is a space in your command it should be properly enclosed in the quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 19:01:57 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/tac-p/2792336#M286</guid>
      <dc:creator>mcpsurfer</dc:creator>
      <dc:date>2011-07-08T19:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling PowerCLI script from a batch file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/tac-p/2792337#M287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Work for me:&lt;/P&gt;&lt;P&gt;Powershell.exe -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -c ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\";C:\Scripts\MyScript.ps1"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2020 16:32:55 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Documents/Calling-PowerCLI-script-from-a-batch-file/tac-p/2792337#M287</guid>
      <dc:creator>giu386</dc:creator>
      <dc:date>2020-05-19T16:32:55Z</dc:date>
    </item>
  </channel>
</rss>

