3 Replies Latest reply on Jul 15, 2013 4:55 PM by tdanner

    Cannot Bind Argument Error Running Windows Scheduled Task

    jdtruman

      Hi Everyone, I'm running a Windows Scheduled Task with a specific service account - it's in GPO, and also has admin access on the server. I receive this error when running the task.

      Cannot bind argument to parameter 'SwisConnection' because it is null.  The task runs fine under my ID.and from cmd.  Is there something I'm missing when setting up the correct security for this service account or SWISConnection?

       

      Thanks, Denise

        • Re: Cannot Bind Argument Error Running Windows Scheduled Task
          tdanner

          What does the Connect-Swis line in the script look like?

            • Re: Cannot Bind Argument Error Running Windows Scheduled Task
              jdtruman

              Hi Tim,

               

              Script looks like this:

               

              1. Create logon credential

               

                              $UserName = "SDK"

                              $PasswordFile = "password.txt"

                              $UserPassword = Get-Content $PasswordFile | ConvertTo-SecureString

                              $cred = New-Object System.Management.Automation.PsCredential($UserName,$UserPassword)

               

              1.             $UserName = ""

              2.             $UserPassword = ""

               

              1.             $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName,($UserPassword | ConvertTo-SecureString -AsPlainText -force)

                              "Credential"

               

                              $cred

               

              1. Add SWIS Snap-in

               

                              Add-PSSnapin SwisSnapin

               

              1. Connect to SWIS

               

                              $swis = Connect-Swis -HostName servername -Credential $Cred