Symantec Management Platform (Notification Server)

 View Only
  • 1.  powershell command fails needing to convert a batch to a PS script

    Posted Jan 17, 2012 10:07 AM

    trying to run a powershell command but when I do I get:
     

    File C:\WINDOWS\TEMP\AltirisScript0151AE281D2E753E37C.ps1 cannot be loaded beca
    use the execution of scripts is disabled on this system. Please see "get-help a
    bout_signing" for more details.
    At line:1 char:2
    + & <<<< 'C:\WINDOWS\TEMP\AltirisScript0151AE281D2E753E37C.ps1'
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

     

    Any one have any idea how to get around this.

     

    Basically I'm trying to work on converting a batch file I have to a PS script because I need a command from PS.  It is the only way for me to complete what I need in XP that I can find.

    Trying to do a release renew of the ip but need to wait sometime inbetween so I can complete some task.  The problem is you can't use the standard ping wait after a release.  So I would like to use Start-Sleep from Powershell.

    I just can't find another way to do this in XP successfully.



  • 2.  RE: powershell command fails needing to convert a batch to a PS script

    Posted Jan 17, 2012 12:01 PM

    http://msdn.microsoft.com/en-us/library/dd347641.aspx

    I think you can change this in Group policy too.

    But can't you ping -n 10 127.0.0.1, the loopback address?

    Or use start /wait to run "some task" so the batch file waits until the task completes.



  • 3.  RE: powershell command fails needing to convert a batch to a PS script

    Posted Jan 17, 2012 01:43 PM

    But can't you ping -n 10 127.0.0.1, the loopback address?

     

    This is my standard method but once you release the IP the ping command fails out right away no matter what you set the time for it is an instant failure so you do not get a delay at all in running this command.

    Start /Wait does not do what I need because I need an actual 5 minute pause inbetween the task not just making sure one task completed.

     

    I have also tried finding sleep.exe and timeout.exe in the support resource kits with no avail even though online all the sites say these tools exist in them.  I also copied timeout.exe from Win7 SysWOW64 dir but it won't run in XP.

     

    So regarding PS I have to open up the ability to run these Altiris doesn't have a way to make the adjustment before running the script and set back or to just make the proper adjustment for that account?

    Everything I read online says if you change this set it back right after running your script.  What does everyone else do?



  • 4.  RE: powershell command fails needing to convert a batch to a PS script

    Posted Jan 17, 2012 01:48 PM

    Tasks
    Jobs and Tasks
    Samples
    Notification Server
    Enable PowerShell Signing Policy

    Clone and use for what you need.



  • 5.  RE: powershell command fails needing to convert a batch to a PS script

    Posted Jan 17, 2012 03:04 PM

    LOL looking at the task you recommend gave me an idea!

     

    It is running a Powershell script to set a setting:

    powershell Set-Executionpolicy restricted
     

    well I want to run Start-Sleep

    So I have added to my batch

    powershell start-sleep 60 

     This appears to be working just as I need it to work!  Just kicking off the one command in a standard command batch.



  • 6.  RE: powershell command fails needing to convert a batch to a PS script

    Posted Jan 18, 2012 09:55 AM

    So now I can kick off my ipconfig /release

    Wait 5 min

    during that time change dhcp servers or make switch changes

    then run ipconfig /renew