As i showed in my post about creation of powershell profile you can add into profile your own frequently used functions. I recommend to name them with permanent prefix. For example i create all my functions as moguy-cdp, moguy-esxi and so on. In this case you don&#8217;t need to remember the name of your function to run, just start typing as moguy&#8230; and autocompletion will show you all your functions. for example: function moguy-vms { Get-VMHost | Get-VM | Select-Object Name, PowerState, NumCpu, MemoryMB, VMhost,  <span><a href="https://www.itforce.mn/index.php/2021/04/30/recommendations-for-powershell-profile/" class="readmore">Continue reading &rarr;</a></span>{"id":1604,"date":"2021-04-30T08:27:34","date_gmt":"2021-04-30T00:27:34","guid":{"rendered":"https:\/\/www.itforce.mn\/?p=1604"},"modified":"2021-04-30T10:11:05","modified_gmt":"2021-04-30T02:11:05","slug":"recommendations-for-powershell-profile","status":"publish","type":"post","link":"https:\/\/www.itforce.mn\/index.php\/2021\/04\/30\/recommendations-for-powershell-profile\/","title":{"rendered":"Recommendations for powershell profile"},"content":{"rendered":"<p>As i showed in <a href=\"http:\/\/www.itforce.mn\/index.php\/2019\/01\/31\/how-to-import-powercli-modules-into-standard-powershell-ise\/\">my post about creation of powershell profile<\/a> you can add into profile your own frequently used functions.<\/p>\n<p>I recommend to name them with permanent prefix. For example i create all my functions as moguy-cdp, moguy-esxi and so on.<\/p>\n<p>In this case you don&#8217;t need to remember the name of your function to run, just start typing as moguy&#8230; and autocompletion will show you all your functions.<\/p>\n<p>for example:<\/p>\n<pre>function moguy-vms\r\n\r\n{\r\n\r\nGet-VMHost | Get-VM | Select-Object Name, PowerState, NumCpu, MemoryMB, VMhost, @{N=\"Datastore\";E={Get-Datastore -vm $_}}, UsedSpaceGB, ProvisionedSpaceGB, @{Name='ToolsVersion';Expression={$_.Guest.ToolsVersion}}, @{Name=\u2019VMHostVersion\u2019;Expression={$_.VMHost.Version}},Version, @{N=\"IP Address\";E={@($_.guest.IPAddress[0])}},@{Name=\u2019Cluster\u2019;Expression={$_.VMHost.Parent}}, @{N=\"PortGroup\";E={Get-VirtualPortGroup -VM $_}}, @{N=\"owner1\";E={$_.customfields.item(\"owner1\")}} | Export-Csv -path c:\\temp\\vms.csv -notypeinformation\r\n\r\n}\r\n\r\nfunction moguy-esxi\r\n\r\n{\r\n\r\nGet-VMHost |Select-Object Name,NetworkInfo,@{N=\"SerialNumber\";E={(Get-VMHostHardware -vmhost $_).SerialNumber}}, @{ N=\"OutOfBandIP\";E={(Get-VMHostWSManInstance -VMHost $_ -ignoreCertFailures -class OMC_IPMIIPProtocolEndpoint).IPv4Address}},Manufacturer,Model,ProcessorType, ConnectionState, PowerState, NumCpu,@{N=\"Cores\/CPU\";E={$_.Extensiondata.Summary.Hardware.NumCpuCores\/$_.Extensiondata.Summary.Hardware.NumCpuPkgs}}, MemoryTotalGB, Version, Build, MaxEVCMode,@{N=\"Lockdown\";E={$_.Extensiondata.Config.adminDisabled}},@{N=\"site\";E={$_.customfields.item(\"00-site\")}}, @{N=\"rack\";E={$_.customfields.item(\"01-rack\")}}, @{N=\"position\";E={$_.customfields.item(\"02-rack-position\")}},Parent | Export-Csv -notypeinformation -Path c:\\temp\\all-vmhosts.csv\r\n\r\n}\r\n\r\nfunction moguy-ntp-get1\r\n\r\n{\r\n\r\nGet-VMHost | Sort Name | Select Name, @{N=\"NTPServer\";E={$_ |Get-VMHostNtpServer}}, Timezone, @{N=\"CurrentTime\";E={(Get-View $_.ExtensionData.ConfigManager.DateTimeSystem) | Foreach {$_.QueryDateTime().ToLocalTime()}}}, @{N=\"ServiceRunning\";E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq \"ntpd\"}).Running}} ` | Format-Table -AutoSize\r\n\r\n}\r\n\r\n\u00a0\r\n\r\nfunction moguy-ntp-get2\r\n\r\n{\r\n\r\nGet-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\"} | select vmhost, label, Key, Policy, Running, Required |format-table -autosize\r\n\r\n}\r\n\r\n\u00a0\r\n\r\nfunction moguy-dc-time\r\n\r\n{\r\n\r\n\"net time \\\\dc01\",\"net time \\\\dc02\",\"net time \\\\dc03\",\"net time \\\\dc04\" | ForEach-Object {cmd.exe \/c $_}\r\n\r\n}\r\n\r\n\u00a0\r\n\r\nfunction moguy-tag1\r\n\r\n{\r\n\r\nGet-VMHost | Get-VMHostHardware | Select-Object vmhost, SerialNumber | Export-Csv -NoTypeInformation -Path c:\\temp\\tag.csv\r\n\r\n}\r\n\r\n\u00a0\r\n\r\nfunction moguy-tag2\r\n\r\n{\r\n\r\nGet-VMHost |get-view |Select-Object Name, @{Name=\"Serial Number\"; Expression={($_.Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.IdentifierType.Key -eq \"ServiceTag\"}).IdentifierValue}}\r\n\r\n}\r\n\r\nfunction moguy-ntp\r\n\r\n{\r\n\r\nGet-VMHost | Add-VMHostNtpServer -NtpServer 192.168.1.44\r\n\r\nGet-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\" } | Start-VMHostService\r\n\r\nGet-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\" } | Set-VMHostService -policy \"automatic\"\r\n\r\n}\r\n\r\n\u00a0\r\n\r\nfunction moguy-round-robin\r\n\r\n{\r\n\r\nGet-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike \"RoundRobin\"} | Set-Scsilun -MultiPathPolicy RoundRobin\r\n\r\n}\r\n\r\nfunction moguy-roundrobin-get\r\n\r\n{\r\n\r\nGet-Vmhost | Get-Scsilun | Select-Object CanonicalName, ConsoleDeviceName,LunType, CapacityGB, MultipathPolicy, vmhost | export-csv -NoTypeInformation -path c:\\temp\\roundrobin.csv\r\n\r\n}\r\n\r\n\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1610\" src=\"http:\/\/www.itforce.mn\/wp-content\/uploads\/2021\/04\/autocompletion.png\" alt=\"\" width=\"416\" height=\"191\" \/>\r\n\r\nIn the same way you can add into autorun all your powershell modules (and surely beforehand you should install all these modules, the downside is the slow start of powershell ISE)\r\nOr you can auto connect to your vmware vcenter or Veeam Backup and Replication server.<\/pre>\n<pre>\r\nimport-module activedirectory\r\nImport-Module SkypeforBusiness\r\nAdd-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;\r\nimport-module HPEiLOCmdlets\r\nimport-module HPENimblePowerShellToolkit\r\nAdd-PSSnapin VeeamPSSnapin\r\n\r\nconnect-viserver vcsa.itforce.local\r\nConnect-VBRServer -server 192.168.1.100\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":null,"protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,17],"tags":[],"class_list":["post-1604","post","type-post","status-publish","format-standard","hentry","category-powercli","category-powershell-tips"],"_links":{"self":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/comments?post=1604"}],"version-history":[{"count":7,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1604\/revisions"}],"predecessor-version":[{"id":1612,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1604\/revisions\/1612"}],"wp:attachment":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/media?parent=1604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/categories?post=1604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/tags?post=1604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}