none
Powershell command not recognized RRS feed

  • General discussion

  • Hello,

    I'm creating a runbook in SCORCH to automate user provisioning. One of the last steps I have is to set the Employee ID using the Run.Net Script activity and Powershell. However, I am getting the following error below. I already have the AD Powershell module installed so I'm stumped at this point on how to resolve the issue. Any help would be greatly appreciated!

    The current script...

    Import-Module ActiveDirectory
    Import-CSV "E:\Test\NewHireTest.csv" -header("First Name", "Last Name","Email","Department","Office","Employee ID","Manager","Job Title","Username") | % {
    $Username = $_.Username
    $EmployeeID = $_.EmployeeID
    Set-ADUser $Username -employeeID $EmployeeID
    }

    The error...

    The term 'Set-ADUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

    • Changed type Bill_Stewart Friday, March 15, 2019 6:39 PM
    • Moved by Bill_Stewart Friday, March 15, 2019 6:40 PM Off-topic
    Thursday, January 24, 2019 11:59 PM

All replies

  • You need to install RSAT to use the AD CmdLets.


    \_(ツ)_/

    Friday, January 25, 2019 12:14 AM
  • Hi there,

    I already have RSAT installed and have imported the AD module but it still gives the same error.

    Friday, January 25, 2019 4:03 PM
  • Works fine for me here.

    We don't know what your configuration error is that might be causing the problem. You will need to troubleshoot that.

    Unfortunately we don't have the resources to be able to troubleshoot this issue for you from afar in a forum.

    If you need a guaranteed answer, I'd recommend contacting Microsoft support.


    -- Bill Stewart [Bill_Stewart]

    Friday, January 25, 2019 4:28 PM
  • Hi Bill,

    If I run the script in Powershell ISE then it works, but if I use the Run.NET activity in SCORCH is where I'm getting the error in the OP.

    Could it be that SCORCH Powershell is running v2.0 and WS2016 is using Powershell v5.0?
    • Edited by Ovrkast Monday, January 28, 2019 4:31 PM
    Monday, January 28, 2019 4:30 PM
  • That might be. This isn't the right place to ask about that, though.

    -- Bill Stewart [Bill_Stewart]

    Monday, January 28, 2019 8:16 PM