Powershell job issues

  • So I am trying to schedule a powershell job on SQL Server

    set-location "c:\Users\sqlagent\Documents"

    .\Funcion_Get-Connection_New.ps1

    .\Test-ADGroupExists.ps1

    .\Get-ImpactProjects.ps1

    $DstDB = $null

    .\Check_DB_LoginsUsersRoles.ps1 "parm0" $DstDB "parm2" "parm3" "parm4"

    In the last script, Check_DB_LoginsUsersRoles.ps1, a call is made to a function created in Get-ImpactProjects.ps1. But the Job History shows an error saying that function could not be found ("is not recognized as a cmdlet, function, ..." etc.

    What am I doing wrong?

  • I think that it is because you are executing the script and it is not considering the "includes" (can't remember the proper term, sorry) in the launching script i.e. you may have to add the following line to your "Check_DB_LoginsUsersRoles.ps1" script:

    .\Get-ImpactProjects.ps1

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply