Release Automation

 View Only
  • 1.  PowerShell - Run Script Block as Administrator

    Posted Dec 30, 2016 08:27 AM

    How can I start a 'PowerShell - Run Script Block' as 'Administrator'?

    I need to start this script block as 'Administrator' as SharePoint 2010 requires this to launch actions towards SharePoint. More specific to load the "Microsoft.SharePoint.Powershell"   --> 'Add-PSSnapIn "Microsoft.SharePoint.Powershell". 

     

    Best regards and thanks for your help,

    Tom



  • 2.  Re: PowerShell - Run Script Block as Administrator

    Posted Jan 02, 2017 03:30 AM

    Hi Tom, have you tried to use the "runas" in the action to impersonate as the administrator?

    Alternatively have a look at:

    Set Privileges for Using PowerShell to Manage SharePoint 

    and

    https://technet.microsoft.com/en-us/library/ff607596.aspx

     

    regards,

    Didier



  • 3.  Re: PowerShell - Run Script Block as Administrator

    Posted Jan 03, 2017 06:45 AM

    Hello Didier,

    Thanks for your reply and happy new year :-)

    Yes I tried "runas" and tested your proposition, same issues:

     

    "Add-SPShellAdmin : The term 'Add-SPShellAdmin' is not recognized as the name of a cmdlet, function, script file, or operable program."

     

     

    The action pack for SharePoint works fine. If we could know how this actions works, action to run "SharePoint PowerShell" as "Administrator" could be build with the SDK. Right?

    Did someone do this already....

     

    Br,

    Tom



  • 4.  Re: PowerShell - Run Script Block as Administrator
    Best Answer

    Broadcom Employee
    Posted Jan 11, 2017 08:02 AM

    Hi Tom

     

    Did you test if you can run the  , Add-PSSnapin Microsoft.SharePoint.PowerShell command in a powershell

    on the agent running this powershell action ?

    Does this work ?

     

    If you keep having problem i would suggest to raise a support case and provide the agent log files

    so we can investigate this .

     

    Regards

    Dirk



  • 5.  Re: PowerShell - Run Script Block as Administrator

    Broadcom Employee
    Posted Jan 17, 2017 07:31 AM

    Hi Tom

     

    Where you able to sort this one out .

    If it did please mark it as the right answer.
    When your question is not answered or you still have additional questions please let us know.

    With Kind Regards

    Dirk



  • 6.  Re: PowerShell - Run Script Block as Administrator

    Broadcom Employee
    Posted Feb 22, 2017 03:30 AM

    Hi Tom
    I believe your questions has been answered, I will mark this as the correct answer.
    When your question is not answered or you still have additional questions please let us know.
    With Kind Regards

    Dirk



  • 7.  Re: PowerShell - Run Script Block as Administrator

    Posted Jun 29, 2017 04:12 AM

    Hello Dirk,

     

    Better late than never.... ;-)

     

    The proposed answer did not work.

    We configured the server so that when a PowerShell script is launched that it runs standard always as 'administrator'. This solution did the 'thing'.

     

    Best regards,

     

    Tom



  • 8.  Re: PowerShell - Run Script Block as Administrator

    Broadcom Employee
    Posted Jun 29, 2017 02:20 PM

    Hi Tom,

     

    It looks like you tried to use the Run As feature. If it wasn't working that way then I wonder if it might have been related to a problem using that feature on Windows. I've only come across one or two issues in the past with this feature on Windows. Details can be found here: "Verify the user running Nolio agent has privileges to impersonate other users" error 

     

    Regards,
    Gregg