Create Folder[Back] This outlines how to create a folder in Power CLI and C# for vSphere: The following shows the details: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using VMware.Vim; using System.Collections.Specialized; using System.Configuration; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { VimClient client = new VimClient(); client.Connect("[vSphere server IP]"); try { UserSession session = client.Login([Username], [Password]); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); return; } NameValueCollection filter = new NameValueCollection(); //filter.Add("Runtime.PowerState", "PoweredOn"); //filter.Add("Config.GuestFullName", "Windows"); //Listand the Power CLI: Connect-VIServer -Server [IP] -User [User] -password [Password] Set-ExecutionPolicy RemoteSigned $folder="netsecurity" new-folder -Name $folder -Location soc_lab foreach ($item in get-content c:\sites.txt) { new-folder -Name $item -Location netsecurity new-vm -name Ubuntu -datastore Production4 -template template_no_ip_ubuntu -resourcepool "Soc Lab" -DiskStorageFormat thin -location $item } |