Windows Vista Forums

set-executionpolicy acting different with different accounts
  1. #1


    Justin Rich Guest

    set-executionpolicy acting different with different accounts

    i RDPed in to a 2k3R2 SP2 server with my AD account, set the execution
    policy to unrestricted and ran my script hosted on a UNC path, worked great.
    i created a schedule task under a different account (local with admin
    rights) and i ran it, and it hung. after some troubleshooting i created a
    shortcut to cmd, changed the run as to that account and ran the commandline
    syntax for the schedule task (powershell \\server\file.ps1)

    when i did that, i got the security warning again. did a check on the
    execution policy and it was still listed as unrestricted....

    what am i missing?

    Thanks
    Justin





      My System SpecsSystem Spec

  2. #2


    Vadims Podans [MVP] Guest

    Re: set-executionpolicy acting different with different accounts

    you have 2 ways:
    1) sign scripts
    2) schedule batch file which should contain something like this:

    copy \\server\share\file.ps1 %temp%
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command
    %temp%\file.ps1
    del %temp%\file.ps1

    --
    WBR, Vadims Podans
    MVP: PowerShell
    PowerShell blog - www.sysadmins.lv

    "Justin Rich" <jrich523@xxxxxx> rakstija zinojuma
    "news:O4qNDAmzJHA.4272@xxxxxx"...

    > i RDPed in to a 2k3R2 SP2 server with my AD account, set the execution
    > policy to unrestricted and ran my script hosted on a UNC path, worked
    > great. i created a schedule task under a different account (local with
    > admin rights) and i ran it, and it hung. after some troubleshooting i
    > created a shortcut to cmd, changed the run as to that account and ran the
    > commandline syntax for the schedule task (powershell \\server\file.ps1)
    >
    > when i did that, i got the security warning again. did a check on the
    > execution policy and it was still listed as unrestricted....
    >
    > what am i missing?
    >
    > Thanks
    > Justin
    >

      My System SpecsSystem Spec

  3. #3


    Justin Rich Guest

    Re: set-executionpolicy acting different with different accounts

    i've been lazy about figuring out how to do the script signing, really need
    to do that. mostly im curious as to why this acts as it does.

    i run this script on all my servers (which is why i run it from the UNC, no
    deployment needed if changed) and it works fine on every other system.

    Thanks


    "Vadims Podans [MVP]" <vpodans> wrote in message
    news:%2348DPcmzJHA.3404@xxxxxx

    > you have 2 ways:
    > 1) sign scripts
    > 2) schedule batch file which should contain something like this:
    >
    > copy \\server\share\file.ps1 %temp%
    > %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command
    > %temp%\file.ps1
    > del %temp%\file.ps1
    >
    > --
    > WBR, Vadims Podans
    > MVP: PowerShell
    > PowerShell blog - www.sysadmins.lv
    >
    > "Justin Rich" <jrich523@xxxxxx> rakstija zinojuma
    > "news:O4qNDAmzJHA.4272@xxxxxx"...

    >> i RDPed in to a 2k3R2 SP2 server with my AD account, set the execution
    >> policy to unrestricted and ran my script hosted on a UNC path, worked
    >> great. i created a schedule task under a different account (local with
    >> admin rights) and i ran it, and it hung. after some troubleshooting i
    >> created a shortcut to cmd, changed the run as to that account and ran the
    >> commandline syntax for the schedule task (powershell \\server\file.ps1)
    >>
    >> when i did that, i got the security warning again. did a check on the
    >> execution policy and it was still listed as unrestricted....
    >>
    >> what am i missing?
    >>
    >> Thanks
    >> Justin
    >>


      My System SpecsSystem Spec

  4. #4


    Vadims Podans [MVP] Guest

    Re: set-executionpolicy acting different with different accounts

    so, now you have a good time to learn script signing
    I have 2 posts about preparing, deploying and mantaining script signing in
    Active Directory environment:
    http://www.sysadmins.lv/PermaLink,gu...7717372c6.aspx
    http://www.sysadmins.lv/PermaLink,gu...82007bb22.aspx
    you should use any online translator from russian.

    I don't know why (may be other powershell guys know?). I have had the same
    problem, when I deployed startup/logon scripts in PowerShell. I found only 1
    solution - sign all scripts.
    --
    WBR, Vadims Podans
    MVP: PowerShell
    PowerShell blog - www.sysadmins.lv

    "Justin Rich" <jrich523@xxxxxx> rakstija zinojuma
    "news:O3YCGvmzJHA.5528@xxxxxx"...

    > i've been lazy about figuring out how to do the script signing, really
    > need to do that. mostly im curious as to why this acts as it does.
    >
    > i run this script on all my servers (which is why i run it from the UNC,
    > no deployment needed if changed) and it works fine on every other system.
    >
    > Thanks
    >
    >
    > "Vadims Podans [MVP]" <vpodans> wrote in message
    > news:%2348DPcmzJHA.3404@xxxxxx

    >> you have 2 ways:
    >> 1) sign scripts
    >> 2) schedule batch file which should contain something like this:
    >>
    >> copy \\server\share\file.ps1 %temp%
    >> %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command
    >> %temp%\file.ps1
    >> del %temp%\file.ps1
    >>
    >> --
    >> WBR, Vadims Podans
    >> MVP: PowerShell
    >> PowerShell blog - www.sysadmins.lv
    >>
    >> "Justin Rich" <jrich523@xxxxxx> rakstija zinojuma
    >> "news:O4qNDAmzJHA.4272@xxxxxx"...

    >>> i RDPed in to a 2k3R2 SP2 server with my AD account, set the execution
    >>> policy to unrestricted and ran my script hosted on a UNC path, worked
    >>> great. i created a schedule task under a different account (local with
    >>> admin rights) and i ran it, and it hung. after some troubleshooting i
    >>> created a shortcut to cmd, changed the run as to that account and ran
    >>> the commandline syntax for the schedule task (powershell
    >>> \\server\file.ps1)
    >>>
    >>> when i did that, i got the security warning again. did a check on the
    >>> execution policy and it was still listed as unrestricted....
    >>>
    >>> what am i missing?
    >>>
    >>> Thanks
    >>> Justin
    >>>
    >
    >

      My System SpecsSystem Spec

  5. #5


    Chad Guest

    RE: set-executionpolicy acting different with different accounts

    I encountered a similar issue on an x64 server. I had to set-executionpolicy
    twice. Once for the x86 and once for the x64 Powershell hosts. Is this server
    X64?

    "Justin Rich" wrote:

    > i RDPed in to a 2k3R2 SP2 server with my AD account, set the execution
    > policy to unrestricted and ran my script hosted on a UNC path, worked great.
    > i created a schedule task under a different account (local with admin
    > rights) and i ran it, and it hung. after some troubleshooting i created a
    > shortcut to cmd, changed the run as to that account and ran the commandline
    > syntax for the schedule task (powershell \\server\file.ps1)
    >
    > when i did that, i got the security warning again. did a check on the
    > execution policy and it was still listed as unrestricted....
    >
    > what am i missing?
    >
    > Thanks
    > Justin
    >
    >
    >

      My System SpecsSystem Spec

  6. #6


    Shay Levy [MVP] Guest

    Re: set-executionpolicy acting different with different accounts

    Hi Justin,


    Check this post from Lee's blog:
    http://www.leeholmes.com/blog/PowerS...ardImages.aspx

    "One way to fix this is by adding the source server to Internet Explorer’s
    Trusted Sites, or
    changing the “UncAsIntranet” configuration property (http://technet.microsoft.com/en-us/l.../bb457150.aspx).

    This is also covered on page 341 of the (my) PowerShell Cookbook."


    ---
    Shay Levy
    Windows PowerShell MVP
    http://blogs.microsoft.co.il/blogs/ScriptFanatic
    PowerShell Toolbar: http://tinyurl.com/PSToolbar



    JR> i've been lazy about figuring out how to do the script signing,
    JR> really need to do that. mostly im curious as to why this acts as it
    JR> does.
    JR>
    JR> i run this script on all my servers (which is why i run it from the
    JR> UNC, no deployment needed if changed) and it works fine on every
    JR> other system.
    JR>
    JR> Thanks
    JR>
    JR> "Vadims Podans [MVP]" <vpodans> wrote in message
    JR> news:%2348DPcmzJHA.3404@xxxxxx
    JR>

    >> you have 2 ways:
    >> 1) sign scripts
    >> 2) schedule batch file which should contain something like this:
    >> copy \\server\share\file.ps1 %temp%
    >> %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -command
    >> %temp%\file.ps1
    >> del %temp%\file.ps1
    >> --
    >> WBR, Vadims Podans
    >> MVP: PowerShell
    >> PowerShell blog - www.sysadmins.lv
    >> "Justin Rich" <jrich523@xxxxxx> rakstija zinojuma
    >> "news:O4qNDAmzJHA.4272@xxxxxx"...
    >>

    >>> i RDPed in to a 2k3R2 SP2 server with my AD account, set the
    >>> execution policy to unrestricted and ran my script hosted on a UNC
    >>> path, worked great. i created a schedule task under a different
    >>> account (local with admin rights) and i ran it, and it hung. after
    >>> some troubleshooting i created a shortcut to cmd, changed the run as
    >>> to that account and ran the commandline syntax for the schedule task
    >>> (powershell \\server\file.ps1)
    >>>
    >>> when i did that, i got the security warning again. did a check on
    >>> the execution policy and it was still listed as unrestricted....
    >>>
    >>> what am i missing?
    >>>
    >>> Thanks
    >>> Justin


      My System SpecsSystem Spec

set-executionpolicy acting different with different accounts problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set-executionpolicy from script ? IT STAFF PowerShell 4 18 Mar 2010
can u automate setting the ExecutionPolicy? James PowerShell 4 17 Apr 2009
Set-Executionpolicy RemoteSigned Larry__Weiss PowerShell 9 25 Mar 2009
set-executionpolicy BinaryCoder PowerShell 4 30 Nov 2007
Set-ExecutionPolicy Unrestricted Stefan Koell PowerShell 28 07 May 2007