Skip to content

Instantly share code, notes, and snippets.

@AglaianWoman
Created October 26, 2017 01:39
Show Gist options
  • Save AglaianWoman/1441a4baf6599f67d23d0dee83570213 to your computer and use it in GitHub Desktop.
Save AglaianWoman/1441a4baf6599f67d23d0dee83570213 to your computer and use it in GitHub Desktop.
PowerShell
# Add PowerCLI snapin and connect to server, if not already done
if (!(Get-PSSnapin VMware.Vimautomation.Core -ErrorAction SilentlyContinue)) {
Add-PSSnapin Vmware.Vimautomation.Core
}
if (!$global:DefaultVIServer) {
Connect-VIServer <vCenterServer>
}
# Analyze XML data
[xml] $xmldata = Get-Content "C:\path.xml"
$xmldata.Foo.Bar | %{$_.Name} | Select-Object Critera
# Set execution policy for current user (does not require administrator privileges)
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
# Map network drive
New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\raytheon\users\bmm" -Persist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment