Skip to content

Instantly share code, notes, and snippets.

@abelal83
Created January 7, 2018 22:02
Show Gist options
  • Save abelal83/1ab1beb0972c7b01b8682717c9e4cdd1 to your computer and use it in GitHub Desktop.
Save abelal83/1ab1beb0972c7b01b8682717c9e4cdd1 to your computer and use it in GitHub Desktop.
change windows NIC profile
# this was used to get around vmware network card being set to public which powershell remoting does not like
$domain = 2
$workHome = 1
$public = 0
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $nlm.getnetworkconnections()
foreach ($connection in $connections) {
if ($connection.getnetwork().getcategory() -eq $public)
{
$connection.getnetwork().setcategory($workHome)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment