Ninite Pro with Active Directory

Today I figured out that my Ninite Pro was not installing updates on all computers automatically. I went in and looked at my list of computers and realized I hadn’t been keeping it up to date when we deploy new computers. Coming from a small environment, it’s pretty easy add them, but in a larger organization, you’d have to automate the process. Using a pretty simple PowerShell script I managed to do this.

$ADAccount = Get-ADComputer -Filter * -SearchBase "OU=Computers,DC=domain,DC=local" | Format-Table Name -HideTableHeaders
$ADAccount
Out-File -FilePath C:\%Some file location%\Output.txt -InputObject $ADAccount -Encoding ascii

The one thing that caught me by surprise (and took a couple hours to figure out) is the -Encoding parameter. By default PowerShell’s Out-File command will send it in Unicode. Apparently Ninite Pro cannot use the Unicode format and has to use ASCII.

I then created another script, that calls the previous script.

## Run script to query AD OU=WSUS_Workstations for machines
C:\%Some file location%\Get_AD_Computer_Name.ps1

## Set $NiniteFile to Computers.txt
$NiniteFile = "C:\%Some file location%\Computers.txt"

## Sets $NiniteLog to log.csv
$NiniteLog = "C:\%Some file location%\log.csv"

## Opens Ninite Pro and runs silent installers to update machines
cmd /c C:\%Some file location%\NiniteOne.exe /updateonly /remote file:"$NiniteFile" /disableshortcuts /disableautoupdate /silent "$NiniteLog"

This will output a log file that gives information regarding the status of each computers updates.