Captain’s log: star date 11, October, 2015 A.D., approximately 12:40 AM EDT.  I’m still wired on coffee.  Eyes glazed.  Responding to email from reader about my previous post about deploying AutoCAD 2016 using Microsoft Intune.

As for deriving a logical WAN mapping of AD site (re: the client) to a nearby UNC deployment share, this is what I was referring to…

function Get-ADSite ($ComputerName) {
  $site = NLTEST /SERVER:$ComputerName /dsgetsite 2>$null
  if ($LASTEXITCODE -eq 0) {
    $site[0]
  }
  else {
    "DEFAULT"
  }
}

$sn = Get-ADSite $env:COMPUTERNAME

switch ($sn) {
  "NYC" {$unc = "\\NYCFS01\apps$\acad2016"; break;}
  "MIA" {$unc = "\\MIAFS03\apps$\acad2016"; break;}
  ...
  default {$unc = "\\CORPFS02\apps$\acad2016"; break;}
}

$cmd = "$unc\img\setup.exe /I /Q /W $unc\img\acad2016.ini /Language en-us"

Assuming you don’t create folders or shares with embedded spaces, the above approach should work fine.  If you are dumb enough, oops, I mean ill-informed enough, to use embedded spaces, you’ll need to insert escaped quotes around the leading and trailing $unc “chunks” above…

$cmd = "`"$unc\img\setup.exe`" /I /Q /W `"$unc\img\acad2016.ini`" /Language en-us"

Night-night.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s