Jump to content


xerkos

Error when executing PS scrips in Task Sequence

Recommended Posts

  •  
I have the following error when I execute my PS script via Run Command Line task in Task Sequence:

Severity Type Site code Date / Time System Component Message ID Description
Error Milestone CS1 3/22/2024 7:33:20 AM MININT-8DHB01O Task Sequence Engine 11135 The task sequence execution engine failed executing the action (Run Command Line - 15) in the group (Install Operating System) with the error code 3221225781 Action output: ... y Bypass -Command "& { [string] $MacAddress = Get-WmiObject Win32_networkadapterconfiguration | where {$_.ipenabled -match 'True'} | select -ExpandProperty MacAddress | select -First 1; $MacAddress = 'PC'+$MacAddress.Replace(':',''); $TSEnv = New-Objct -COMObject Microsoft.SMS.TSEnvironment; $TSEnv.Value('OSDComputerName') = $MacAddress;}"' SwdAction = '0001' Command line for extension .exe is "%1" %* Set command line: Run command line Working dir 'not set' Executing command line: Run command line Process completed with exit code 3221225781 Command line C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { [string] $MacAddress = Get-WmiObject Win32_networkadapterconfiguration | where {$_.ipenabled -match 'True'} | select -ExpandProperty MacAddress | select -First 1; $MacAddress = 'PC'+$MacAddress.Replace(':',''); $TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $TSEnv.Value('OSDComputerName') = $MacAddress;}" returned 3221225781. The operating system reported error 1: Incorrect function.


Regards.
Xerkos.

Share this post


Link to post
Share on other sites

can you share exactly what you have in the step that's failing?

 

i do see the following typo above

 

$TSEnv = New-Objct

 

should be

 

$TSEnv = New-Object

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.