Jump to content


kevlar01

Computername doesn't change during task sequence

Recommended Posts

Hi,

Since a while we have problems with a step during our Windows 10 task sequence. This step is a powershell script which changes the computer description based on a variable which is set during the OSDMenu.hta (a form which pops up in the beginning of the task sequence where the computerdescription is filled out). 

For whatever reason, this step doesn't work anymore, but in the past this worked fine.

The computerdescription isn't too long (more than 15 characters), and the user which is used in this step has sufficient rights. I have also tested it with a domain admin account but it didn't make any difference. We also have a step which sets the computername but this is no issue.

 

The script which is used is the following:

 

Quote

# Script to set the Computer description in AD for the computer on which it is executed from.
# Example Command line Powershell.exe -Set-ExecutionPolicy bypass -file .\SetComputerDesc "Computer Description"

[string]$Description = $args[0]

    try {

        $ComputerDn = ([ADSISEARCHER]"sAMAccountName=$($env:COMPUTERNAME)$").FindOne().Path
        $ADComputer = [ADSI]$ComputerDn
        $ADComputer.description = $Description
        $ADComputer.SetInfo()

    }
    catch {
        $_.Exception.Message ; Exit 1
    }

 

I have created a status message query for the task sequence and the error stated says it is an 'Incorrect function'

Quote

The task sequence execution engine failed executing the action (Set Computer Description) in the group (Windows 10 customization) with the error code 1
Action output: ... VerifyContentHash: Hash algorithm is 32780
Content successfully downloaded at C:\_SMSTaskSequence\Packages\REF000B0.
Resolved source to 'C:\_SMSTaskSequence\Packages\REF000B0'
Command line for extension .exe is "%1" %*
Set command line: Run command line
Working dir 'C:\_SMSTaskSequence\Packages\REF000B0'
Executing command line: Run command line with options (0, 4)
Create a process under given user token
Process completed with exit code 1
Exception calling "FindOne" with "0" argument(s): "Onbekende fout (0x80005000)"
Command line is being logged ('OSDDoNotLogCommand' is not set to 'True')
Command line powershell.exe -NoProfile -ExecutionPolicy ByPass -File SetComputerDesc.ps1 "Voorraad" returned 1
ReleaseSource() for C:\_SMSTaskSequence\Packages\REF000B0.
reference count 1 for the source C:\_SMSTaskSequence\Packages\REF000B0 before releasing
Released the resolved source C:\_SMSTaskSequence\Packages\REF000B0
Exception calling "FindOne" with "0" argument(s): "Onbekende fout (0x80005000)". The operating system reported error 1: Incorrect function. 

 

 

Anyone else which has this problem?

 

Share this post


Link to post
Share on other sites

incorrect function means the script is failing,

is the script itself logging to anywhere ? if not, what does smsts.log reveal for this step in the task sequence

Share this post


Link to post
Share on other sites

Thanks for your quick reply Anyweb. Unfortunately the script has no logging of itself.

 

Below is a snippet from the smsts.log of a computer rolled out a while ago (the issue was existing at that time).

 

Quote

 ============================== [ OSDRunPSScript.exe ] ==============================     RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Running module version 5.0.9058.1000 from location 'C:\WINDOWS\CCM\OSDRunPowerShellScript.exe'    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Package ID containing the PowerShell script is REF000B0    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
PowerShell script name is SetComputerDesc.ps1    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
The execution scope for running the PowerShell script is specified not to verify the signature of the scripts. This is unsafe and potentially risk running malicious scripts.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Sending warning status message    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
   Setting URL = xxx, Ports = 80,443, CRL = false    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
   Setting Server Certificates.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
   Setting Authenticator.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
   Setting Media Certificate.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Sending StatusMessage    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Setting the authenticator.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
CLibSMSMessageWinHttpTransport::Send: WinHttpOpenRequest - URL: xxxx:80  CCM_POST /ccm_system/request    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Not in SSL.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Request was successful.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Running PowerShell script: 'SetComputerDesc.ps1'(PkgID: REF000B0) with execution policy: 'Bypass'    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Getting linked token    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
failed to get the linked token information. It may not be available. Error 1312    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Get RunAs private desktop SMSTS-201640\SMSTSDesktop    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Will run PowerShell script under USER account 'xxx\SVC_SCCM_DomainJoin'    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
PowerShell path: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
ResolveSource flags: 0x00000000    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
SMSTSPersistContent: . The content for package REF000B0 will be persisted    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
The package REF000B0 is found locally in the cache C:\_SMSTaskSequence\Packages\REF000B0    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Resolved source to 'C:\_SMSTaskSequence\Packages\REF000B0'    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Working dir 'C:\_SMSTaskSequence\Packages\REF000B0'    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Command line for extension .exe is "%1" %*    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Set command line: Run PowerShell Script    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
PowerShell command line is NOT shown in the log ('OSDLogPowerShellParameters' is NOT set to 'True')    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Executing command line: Run PowerShell Script with options (0, 4)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Create a process under given user token    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
CreateProcessAsUser( m_hUserToken, NULL, (LPWSTR)m_sCommandLine.c_str(), NULL, NULL, TRUE, bNT ? CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT : CREATE_NEW_CONSOLE, m_pEnvironmentBlock, pszWorkingDir, &si, &pi ), HRESULT=8007010b (X:\bt\1022896\repo\src\Framework\Core\CCMCore\CommandLine.cpp,1052)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
CreateProcessAsUser failed. Code(0x8007010B)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Command line execution failed (8007010B)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
clCommandLine.Execute(uOptions, pszWorkingDir, lpDesktop), HRESULT=8007010b (X:\bt\1204713\repo\src\client\OsDeployment\RunPSScript\main.cpp,517)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Failed to execute PowerShell command line    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
ReleaseSource() for C:\_SMSTaskSequence\Packages\REF000B0.    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
reference count 1 for the source C:\_SMSTaskSequence\Packages\REF000B0 before releasing    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Released the resolved source C:\_SMSTaskSequence\Packages\REF000B0    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
ExecutePowerShellScript(sScriptName, sParameters, sPackageID, sExecutionPolicy, sOutputVariableName, dwPSRunExitCode), HRESULT=8007010b (X:\bt\1204713\repo\src\client\OsDeployment\RunPSScript\main.cpp,944)    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Run PowerShell script failed to run, hr=0x8007010b    RunPowerShellScript    24-11-2021 15:39:01    2992 (0x0BB0)
Process completed with exit code 2147942667    TSManager    24-11-2021 15:39:01    4584 (0x11E8)
!--------------------------------------------------------------------------------------------!    TSManager    24-11-2021 15:39:01    4584 (0x11E8)
Failed to run the action: Set Computer Description - xxx. Error -2147024629    TSManager    24-11-2021 15:39:01    4584 (0x11E8)
 

 

Share this post


Link to post
Share on other sites

the first problem seems to be this

 

CreateProcessAsUser failed. Code(0x8007010B)  

 

which translates to...

image.png

you could try pressing F8 when the HTA is on screen, and running your powershell script manually to see if that gives any clues, or modify the original script to include logging to capture the exception message to a log file so we see what's actually wrong,

that's what i'd do...

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.