Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Automatic Software Deployment with Ninite
## Ninite AD Deployment v0.1
## Wrote by fen //
## Have to import AD module for AD manipulation
Import-Module ActiveDirectory
## Variables
$domainName = ""
## An example would be "OU=Laptops,OU=Computers,DC=Just,DC=fen,DC=com"
## This would be equivalent to the following\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
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
You can’t perform that action at this time.