Skip to content

Instantly share code, notes, and snippets.

@fenneh
Created June 8, 2012 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenneh/2898367 to your computer and use it in GitHub Desktop.
Save fenneh/2898367 to your computer and use it in GitHub Desktop.
Automatic Software Deployment with Ninite
## Ninite AD Deployment v0.1
## Wrote by fen www.justfen.com // twitter.com/justfen_/
## github.com/justfen fen@justfen.com
## Have to import AD module for AD manipulation
Import-Module ActiveDirectory
## Variables
$domainName = "just.fen.com"
## An example would be "OU=Laptops,OU=Computers,DC=Just,DC=fen,DC=com"
## This would be equivalent to the following just.fen.com\Computers\Laptops
$OU = "OU=Laptops,OU=Computers,DC=Just,DC=fen,DC=com"
$NiniteCache = "R:\Ninite\Cache\"
$NiniteTargets = "R:\Ninite\NiniteTargets.txt"
$NiniteLog = "R:\Ninite\log.txt"
$NiniteDir = "R:\Ninite\"
function MachineGenerate {
# Create a PSDrive to manipulate AD
New-PSDrive -PSProvider ActiveDirectory -Name ADNinite -Root "" -Server "$domainName"
chdir ADNinite:
Get-ADComputer -Filter * -SearchBase "$OU" | Select -Expand Name | Out-File "$NiniteTargets" -Encoding Default
chdir $NiniteDir
Remove-PSDrive -Name ADNinite
}
MachineGenerate
cmd /c NiniteOne.exe /updateonly /remote file:"$NiniteTargets" /disableshortcuts /disableautoupdate /cachepath "$NiniteCache" /silent "$NiniteLog"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment