By Default the DataProtector Agent runs under LocalSystem which cannot interact as freely as a normal user.
My guess is that runas is restricted for this Account. Try starting the Agent under a named User (maybe already with admin-rights) or use the Impersonation-Feature to run the Script under another user-context.