I wrote a script to import all drivers in a folder into CM 2012 and make the folder name the category / driver package. I have the category and driver stuff all working, but can't get the Import-CMDriver cmdlet to work. First, I tried to specify a folder instead of an inf file to import but it errored out. The documentation here: http://technet.microsoft.com/en-us/library/dn151073(v=sc.20).aspx makes it sound like I can do that when it says this:
-UncFileLocation<String> Specifies the network path (UNC) of the device drivers. To import all the device drivers that are contained in a specific folder, specify the network path to the device driver folder. For example: \\servername\folder. To import a specific driver from a folder, specify the network path (UNC) to the Windows device driver .INF or mass storage Txtsetup.oem file of the driver. Anyway, that's just an annoyance. So since it wasn't working I re-wrote the import driver part to cycle through all inf files in the Driver folder and individually import them. This kind of works. When I run the Import-Driver command, it errors out with this error: Object reference not set to an instance of an object. However, the driver is created in ConfigMgr with the correct AdministrativeCategory and all the correct settings but it is not in the correct Driver Package. So, annoyed with this I decided to run the command without the Driver Package information in it, save it to a variable, and then run the Add-CMDriverToDriverPackage command specifying the Driver Package object and the Driver object. It errors out still with no Driver Package information and doesn't return an object, so I can't run Add-CMDrivertodriverpackage... Any ideas? Here is the command I'm running: Import-CMDriver -UNCFileLocation $Driver.FullName -AdministrativeCategory $Category -DriverPackage $DriverPackage -ImportDuplicateDriverOption AppendCategory -EnableAndAllowInstall $True -UpdateDistributionPointsforDriverPackage $True