running UIResource.UIResourceMgr as system account

0

I have the below PowerShell script that will trigger a software center task sequence. If I run this in my lab environment all is good and it works. The issue is that the users cant run powershell using their standard logins, so I have to use the system account via a task schedule that runs on login. Any ideas on how to trigger a task sequence when running the script as System ?

$UI = New-Object -ComObject "UIResource.UIResourceMgr"

$ProgramID = "*"
$PackageID = "MyTaskSequence"

$UI.ExecuteProgram($ProgramID, $PackageID, $true)

I get the following error

New-Object : cannot find type [-comobjectUIResource.UIResourceMgr]:

verify that the assembly containing this type is loaded

Ok, I have done a bit more research. If I launch a PowerShell console as System it would appear that it cant find the UIResource.UIResourceMgr assembly. Any ideas on how to load it ? I have tried

[Reflection.Assembly]::LoadFile("C:\Windows\CCM\UIResource.dll") 

But this did not work either. As I get :-

Exception calling "LoadFile" with "1" argument(s): "The module was expected 
to contain an assembly manifest. (Exception from HRESULT: 
0x80131018)"
powershell
asked on Stack Overflow Apr 9, 2018 by Simon B • edited Apr 11, 2018 by Simon B

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0