MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
632 stars 281 forks source link

DriverUpdate throws "unable to construct Microsoft.SMS.TSEnvironment object" #101

Closed dsolodow closed 5 years ago

dsolodow commented 5 years ago

Version 2.1.5 of the script, trying to run the script in FullOS to do a driver update. On the few machines I've tested on (Windows 10 x64), when running the script in an elevated PowerShell session, it throws "WARNING: Unable to construct Microsoft.SMS.TSEnvironment object"

Running the script with -URI "URL" -SecretKey "key" -Filter "Driver" -DeploymentType DriverUpdate

dsolodow commented 5 years ago

Looking through the script, it looks like even when planning to use it for a DriverUpdate in full os, you have to run it as part of a task sequence rather than say via the command line?

ghost commented 5 years ago

Hey, I see that this is marked as closed but I'm getting this issue even when running as a task sequence. What else did you have to do in order to get this working?

Version 2.2.3 Running with the same TS Parameters: -URI "URL" -SecretKey "key" -Filter "Driver" -DeploymentType DriverUpdate

chaosisbliss commented 5 years ago

I am also getting this particular error. Any updates on the resolution?

Eazygoins commented 5 years ago

Same thing hear. Can we re-open this thread?

chaosisbliss commented 5 years ago

This isn't an issue with the function of the parameters but how the task sequence calls on 32 bit instead of 64 bit in the initial task sequence. Your boot image is probably 64bit.

You can solve this by using command line to call powershell and pass your parameters.

Insert a command line, and do the following. Be sure to update your server uri and secret key.

%systemroot%\system32\windowspowershell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExcutionPolicy Bypass -File Invoke-CMApplyDriverPackage.ps1 -URI "your server"/ConfigMgrWebService/ConfigMgr.asmx" -SecretKey "yoursecretkey" -Filter "Drivers" -DeploymentType DriverUpdate

amird1982 commented 5 years ago

I'm getting the exact same error when trying to run it manually or outside of a task sequence,

Is there a resolution for it?

Can we re-open this thread?

chaosisbliss commented 5 years ago

Amird1982...did you read my earlier post on how to solve the issue? You have to call powershell from a command line.

amird1982 commented 5 years ago

I have tried that, exactly as you have mentioned from command prompt, but I still get this warning, and as it seems it doesn't work, I don't see it does anything and drivers are not getting updated,

As a side note, I also tried to deploy this powershell script from SCCM too but I'm getting a message that "The mximum number of parameters is 10" when I try to create the script in SCCM, this script seems to have 11 parameters,

Please help, Thanks,

chaosisbliss commented 5 years ago

No. You need to install everything that comes with the Driver Automation Tool including the webservice. This will provide you with your secret keys and uri etc. You will need a package that references each of the bios and driver powershell scripts to call within a sccm task sequence. This task sequence will be a command line instead of powershell.

amird1982 commented 5 years ago

I did install the web service, and have the URI, I also can open the URI from browser,

But I don't want to use it as OS deployment, I would like to deploy it as package or script which will update drivers on existing computers,

Not sure what I'm doing wrong,

Please help,

Thanks,

chaosisbliss commented 5 years ago

That makes sense. However, you're looking at the task sequence from an OS Deployment standpoint which isn't what you need to do.

Use the task sequence to deploy your package to update the bios and drivers. You don't need to update the OS. I actually have one for PXE and another for Post PXE. I actually use Task Sequences to deploy stuff all of the time.