Running a PS script with elevated privilages

This is what I would like:User opens the script with PowerShellUser must enter password of domain admin (secure string)Script starts running as Domain AdminI have not been able to find any solution for this, 
any help would be appreciated!

Hello,Currently I have a batch script that moves files of a certain type from one folder to an archive folder with the current date. The script I use for this is:Batchfilefor /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%amkdir C:\ArchiveReportFiles\Archive\%date:/=%robocopy /E C:\eFinancials\report C:\ArchiveReportFiles\Archive\%date:/=% *.pdf /mov /minage:100 This works fine but it looks at the date modified not the date created so i still have files from over 2 years in there if somebody opened them by mistake, so I'm trying to recreate the the same script but using Powershell so I can use the CreationTime variable. I've got this:Powershell$dirname = "$((get-date).toString('dd-MM-yyyy'))"New-Item -ItemType directory -Path "C:\aa_Mine\test\PowershellTest\testto\$dirname"get-childitem -Path "C:\aa_Mine\test\PowershellTest...

Similar Messages

  • What is the best way to run a powershell script with parameters in the Task Scheduler?

    Hello, 
    Want to run the following from a scheduled task in the Task Scheduler on a server.  What is the best approach?
    .\pscript.ps1 -csvfile "\\Srv1\Share\File.txt"
    Thanks for your help! SdeDot

    Hi,
    To run a powershell script with parameters in the Task Scheduler:
    Program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Add argument (optional): -Command "& c:\scripts\test.ps1 -par1 2 -par2 3"
    Hope the below two articles be helpful for you:
    Schedule PowerShell Scripts that Require Input Values
    https://blogs.technet.com/b/heyscriptingguy/archive/2011/01/12/schedule-powershell-scripts-that-require-input-values.aspx
    How to Schedule a PowerShell Script
    http://dmitrysotnikov.wordpress.com/2011/02/03/how-to-schedule-a-powershell-script/
    Regards,
    Yan Li
    Regards, Yan Li

  • A way to run bundle tests scripts with EBS 11.5.10.2

    Hi,
    looking for a way to run bundle tests scripts with EBS 11.5.10.2. We prepare our tests scenarios and run them manually now but would rather job them and verify results of testing on logs created by the automatic execution of these scripts.
    We use UPK for preparing and supporting our training activities and I read that UPK features a way to prepare and run bundle tests scipts. Does anybody from the community knows something about that? I haven't found a guide to explain how to do it.
    Hoping someone to lead me to the topic I'm looking for. Does any release of UPK can do this and how or the community uses another tool to do so
    Alain

    UPK allows you to create manual test scripts which can be imported into a variety of testing suites. UPK does not provide automated test scripts. In the current release, the name of the publishing style is "HP Quality Center". This will create a spreadsheet document that can then be imported into a variety of testing suites as a test script. The product documentation should give you all the information you need to start using the HP Quality Center output. If not, here is a blog post describing how to use UPK to create an output for IBM Rational Quality Manager, which may help describe how this process works:
    http://blogs.oracle.com/UPK/2010/05/upk_and_rqm.html
    I hope this helps.
    Best regards,
    Marc

  • Run a powershell script with domain credentials during task sequence

    I have a powershell script that adds the computer it is run on to a security group.  If I log onto the computer with a domain account it works perfectly.  However, if it is run while logged on as the local admin account it fails with an error message
    that says the domain either doesn't exist or cannot be reached.
    This is a problem because when a computer is being imaged the process runs with the local admin account.  Is there a way to run this script with domain credentials in the task sequence?
    Thanks,
    Andy

    How are you running the Powershell script? If you use a Run Command Line step, you can specify an account to run as. Something like "powershell %scriptroot%\psscript.ps1" where the psscript.ps1 is located in your Scripts folder in your deployment
    share.
    -Nick O.

  • Running a SqlPlus script with AT.EXE on WIN NT4.0

    Hi guys,
    I've to periodically run a simple batch script to update some tables on an Oracle DB. Since I'm
    running a Server Win NT4.0 SP6 I made a .cmd that calls a sqlplus script and I'm trying to
    schedule it using the AT.EXE service.
    When I run the .cmd outside from the AT it works fine; when I try to run it using AT something
    goes wrong and I got this error:
    ERROR:
    ORA-03113 end-of-file on communication channel
    I suspect it depends on how AT / sqlplus handle standard I/O but I wasn't able to find the
    right way to call them or a work around to make things work.
    Any suggestion ??
    TIA,
    Max
    Here's the script:
    @echo off
    rem
    rem run sql script (connect info in script)
    rem
    sqlplus -S /NOLOG @d:\UpdBatch\upd_table.sql %1 %2
    rem
    rem trace result in EventLong
    rem
    SET result=%ERRORLEVEL%
    IF '%result%'=='1' LOGEVENT -m \\MINERVA -s E -e 1 -r "BATCH UPDATE" "Error updating tables!"
    goto finished
    LOGEVENT -m \\MINERVA -s I -e 0 -r "BATCH UPDATE" "Tables Updated!"
    :finished
    echo "Done!"
    and I register it in AT in this way:
    D:>at 15:30 cmd.exe /C "d:\UpdBatch\my_script.cmd 10 20 > d:\temp\out.txt"
    null

    I did not notice that the cut and paste was poor. It should have read
    SQL> @dm$load.pkb
    SP2-0310: unable to open file "dm$load.pkb"
    SQL> host ls
    dm$load.pkb
    Any ideas will be greatly appreciated.

  • How can you run a command with elevated rights on a remote server with invoke-command ?

    I am trying to run a script on a remote server with invoke-command.  The script is starting and is running fine, but the problem is that it should be running with elevated rights on the remote server.  On the server where I start the invoke-command, my account has the necessary rights.
    The server were I launch the invoke-command is a W2K8 R2.  The remote box is a W2K3 with powershell v2.0 installed.
    When I launch the script on the remote-box from the command line, I don't get the access denied's.
    Is there a way to do this ?
    Thanks in advance

    The script that I want to run is to install the windows updates.  I get an access denied on the download of the updates.
    When I execute the script on an W2K8 box, (not remotely) and I run it with non-elevated rights, I get the same error.
    The script is running fine when it is launched on W2K3 box locally with a domain account that has local admin rights, or on a W2K8 R2 server with a domain account that has local admin rights, but with elevated rights.
    Thanks in advance for your help.
    #=== start script ====
    param($installOption="TESTINSTALL",$rebootOption="NOREBOOT")
    Function Show-Help
    Write-Host ""
    Write-Host "SCRIPT: $scriptName <installOption> <RebootOption>"
    Write-Host ""
    Write-Host "DESCRIPTION: Installatie van WSUS updates op de lokale server"
    Write-Host ""
    Write-Host "PARAMETERS"
    Write-Host " -installOption <[INSTALL|TESTINSTALL]>"
    Write-Host " -rebootOption <[REBOOT|NOREBOOT|REBOOT_IF_UPDATED]>"
    Write-Host ""
    Write-Host "EXAMPLE:"
    Write-Host "$ScriptName -installOption INSTALL -rebootOption REBOOT_IF_UPDATED"
    Write-Host "$ScriptNAme INSTALL NOREBOOT"
    Write-Host ""
    Write-Host "Indien beide parameter weggelaten worden zijn de defaultwaarden :"
    Write-Host " installOption=TESTINSTALL "
    Write-Host " RebootOption=NOREBOOT"
    Write-Host ""
    Exit
    #Include alle globale variablen
    $CEIF_WIN_PATH = (get-content env:CEIF_WIN_PATH)
    $includeFile=$CEIF_WIN_PATH + "\Scripts\include_win.ps1"
    . $includeFile
    #initialiseer error count
    $errcnt=0
    $scriptName=$MyInvocation.MyCommand.Name
    #argumenten controleren
    $arrInstallOption= "TESTINSTALL", "INSTALL" # Mandatory variable with predefined values
    If (!($arrInstallOption –contains $installOption)){ Show-Help }
    $arrRebootOption = "REBOOT", "NOREBOOT","REBOOT_IF_UPDATED" # Mandatory variable with predefined values
    If (!($arrRebootOption –contains $rebootOption)){ Show-Help }
    #Logfile opbouwen
    $logfile = get-logfileName($MyInvocation.MyCommand.Name)
    Log-scriptStart $MyInvocation.MyCommand.Name $logfile
    function Get-WIAStatusValue($value)
    switch -exact ($value)
    0 {"NotStarted"}
    1 {"InProgress"}
    2 {"Succeeded"}
    3 {"SucceededWithErrors"}
    4 {"Failed"}
    5 {"Aborted"}
    function boot-server()
    if ($installOption -eq "TESTINSTALL")
    logger "TESTINSTALL : - Reboot local Server" $logfile
    else
    logger " - Reboot local Server" $logfile
    $thisServer = gwmi win32_operatingsystem
    $thisServer.psbase.Scope.Options.EnablePrivileges = $true
    $thisServer.Reboot()
    $logmsg="Install option = " + $installOption + ", RebootOption = $rebootOption"
    logger "$logmsg" $logfile
    logger "" $logfile
    logger " - Creating WU COM object" $logfile
    $UpdateSession = New-Object -ComObject Microsoft.Update.Session
    $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
    logger " - Searching for Updates" $logfile
    $SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")
    logger " - Found [$($SearchResult.Updates.count)] Updates to Download and install" $logfile
    $Updates=$($SearchResult.Updates.count)
    logger "" $logfile
    foreach($Update in $SearchResult.Updates)
    if ($Update.EulaAccepted -eq 0)
    $Update.AcceptEula()
    # Add Update to Collection
    $UpdatesCollection = New-Object -ComObject Microsoft.Update.UpdateColl
    $UpdatesCollection.Add($Update) | out-null
    if ($installOption -eq "TESTINSTALL")
    else
    # Download
    logger " + Downloading Update $($Update.Title)" $logfile
    $UpdatesDownloader = $UpdateSession.CreateUpdateDownloader()
    $UpdatesDownloader.Updates = $UpdatesCollection
    $DownloadResult = $UpdatesDownloader.Download()
    $Message = " - Download {0}" -f (Get-WIAStatusValue $DownloadResult.ResultCode)
    if ($DownloadResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    # Install
    logger " - Installing Update" $logfile
    $UpdatesInstaller = $UpdateSession.CreateUpdateInstaller()
    $UpdatesInstaller.Updates = $UpdatesCollection
    $InstallResult = $UpdatesInstaller.Install()
    $Message = " - Install {0}" -f (Get-WIAStatusValue $InstallResult.ResultCode)
    if ($InstallResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    logger "" $logfile
    #Indien er een fout gebeurde tijdens download/installatie -> stuur mail naar windowsteam
    if ( $errcnt -gt 0 )
    logger " - Fout tijdens de uitvoering van script -> send mail" $logfile
    $mailSubject=$MyInvocation.MyCommand.Name
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($logfile)
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = $mailFrom
    $msg.To.Add($mailTo)
    $msg.Subject = $mailSubject
    $msg.Body = “Meer details in attachement”
    $msg.Attachments.Add($att)
    $smtp.Send($msg)
    #Moet de server herstart worden ?
    if ($rebootOption -eq "REBOOT_IF_UPDATED" )
    if ($Updates -gt 0)
    #Reboot the server when updates are installed
    boot-server
    elseif ($rebootOption -eq "REBOOT")
    #reboot the server always
    boot-server
    else
    #Do not reboot the server
    logger "Do not reboot the server" $logfile
    Log-scriptEnd $MyInvocation.MyCommand.Name $logfile
    exit 0

  • Need to run netsh command with elevated previledges

    Hi Team,
    I am running an script with netsh command for to enable file & print sharing module and that to only for an domain profile.
    But when i try to call this command through VB script, it asks me to run that in elevated previledges.
    PLease help me how do i achieve that, or is there any feasibility to invoke same in bat file itself, please let me know.
    Regards,
    Deepak Sharma.

    Here are couple of URL that might help you : 
    http://stackoverflow.com/questions/17466681/how-to-run-vbs-as-administrator-from-vbs
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/310e57f9-2367-4293-9f97-53d0e077aacc/vb-script-to-run-a-batch-script-as-admin?forum=ITCG
    http://www.server-world.info/en/note?os=Other&p=vbs
    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

  • Make a DSC Script resource execute with elevated privileges

    Hello Everyone,
    Is there a built-in way into DSC to make it execute certain resources as administrator with elevated privileges on Windows 8.1?
    What's i'm trying to achieve for example is install SQL Express 2012 in a Script DSC resource, but it keeps telling me that i'm not admin with and fails. If i run the same command from command prompts ("As administrator") it succeeds.
    C:\downloads\SQLEXPR_x64_ENU.exe /Action=Install /qs /IAcceptSQLServerLicenseTerms /InstanceName=sqlexpress /ROLE=AllFeatures_WithDefaults /SQLSYSADMINACCOUNTS="BUILTIN\Administrators"
    A similar situation is when I want to disable Windows Firewall in a WindowsProcess resource:
    powershell.exe "netsh firewall set opmode disable"
    That would also blow up because i'm not admin.
    I've tried to give the admin credentials to the DSC resources but it seems on windows 8.1, it's different from "Run as Administrator"
    So far I've managed to achieve some of this by running it from a PSExec session to the same machine which i'm currently configuring, but this seems like a hack to me.
    Please let me know if there is a way around this.
    Thanks in advance!
    Ivan Kosharov

    Any update on this?

  • Memory Error in Bridge while running a script with multiple moveTo()'s.

    I have written a script to create folders based on the names of assets in the parent folder, then move the assets with matching names into the appropriate folders. The script runs perfectly up to somewhere between 1,000 to 1,500 images moved and then I receive a memory error from Bridge.
    I have been running this on folders with an excess of 25,000 assets in them. My work around was to put a simple counter in the script to let me know when 1,000 assets had been moved, throw up an alert, and then I would view the Task Manager to let me know when the CPU usage had dropped below 50% and would ok the alert, then it would run the next 1000 assets.
    My question, is it possible in scripting to monitor your memory usage to allow a pause in the script so Bridge processing can catch up?

    Don't do that!
    $.sleep() doesn't "sleep". ExtendScript is not multi-threaded. $.sleep just waits on the $.sleep() command to execute. It actually blocks all processing rather than free up the processor to do things like garbage collection.
    First try the $.gc() command. To my knowledge there is no way to track ES' memory usage.
    If that doesn't work, try scheduling a task...
    Let's say that you find that after 1000 moves, it takes 60 seconds for the processor to cool off:
    doAThousandMoves = function() {
    // execute 1000 moves
    app.scheduleTask( "doAThousandMoves()", 60000, true );
    The way I would actually code this is to scan the folder tree and create a global array that contained all of the files to be moved.
    I would then move them 1 at a time, shifting them off the array. Something like this:
    var mover = {}; // global object declaration
    mover.init = function() {
    mover.files = new Array();
    // fill mover files with the file objects to be moved.
    app.scheduleTask( "mover.move()", 10 );
    mover.move = function() {
    var i = 0;
    while ( i++ < 1000 ) {
    file = mover.files.shift();
    // move file
    if ( mover.files.length > 0 ) {
    app.scheduleTask( "mover.move()", 60000 );
    In fact, you should probably break this into chunks of about 10 or so at a time (you can reduce the gap between calls). Doing so will make the operation appear to be running as a background process.
    Regards
    Bob

  • Running script with linux32 breaks package installs

    Hi,
    I'm running on an x86_64 system and I was trying to install the PPD and other files needed for my Panasonic KX-MB2030 printer.  I tried running the install script Panasonic provided, but it complained that it's not meant for an x64 system.  Then, I ran the script again with:
    linux32 ./install-linux
    The script ran, but now I cannot install any programs.  For instance, CUPS complained that libcups wasn't working properly (probably because the script overrode some of its files), but when I go to reinstall libcups, I get a message like this:
    :: package libcups-1.5.3.-5-i686 does not have a valid architecture
    I've tried installing other packages, but they all complain about how the i686 version of the package is not valid.  I tried to switch back using 'linux64', but Arch still won't let me install any packages.
    Please let me know if you have any suggestions.
    Thanks!
    Matt
    Last edited by stantheman286 (2012-07-08 15:56:20)

    Sure, here it is:
    #!/bin/bash
    # batch file to install Panasonic Printer Driver
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo " Install MUST be run as root" 1>&2
    exit 1
    fi
    BUILD_CPU=i686
    TARGET_CPU=`uname -m`
    INSTALL_PATH="/usr/local/share/panasonic/printer"
    # check can install to thie system
    CAN_INSTALL=no
    FILTER_PATH_SEARCH=""
    MODEL_PATH_SEARCH=""
    case $TARGET_CPU in
    i[345]86)
    case $BUILD_CPU in
    i386)
    CAN_INSTALL=yes
    esac
    i686)
    case $BUILD_CPU in
    i[36]86)
    CAN_INSTALL=yes
    esac
    x86_64)
    case $BUILD_CPU in
    x86_64)
    CAN_INSTALL=yes
    esac
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/lib64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/libexec64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/lib64/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/libexec64/cups/filter"
    esac
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/share/cups/model"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/local/share/cups/model"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/share/ppd"
    MODEL_PATH_SEARCH="$MODEL_PATH_SEARCH /usr/local/share/ppd"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/lib/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/libexec/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/lib/cups/filter"
    FILTER_PATH_SEARCH="$FILTER_PATH_SEARCH /usr/local/libexec/cups/filter"
    if test "x$CAN_INSTALL" != "xyes"; then
    echo "the package is build for $BUILD_CPU cpu, can not install to $TARGET_CPU system"
    exit 1
    fi
    # find install dir
    FILTER_PATH=""
    for DIR in $FILTER_PATH_SEARCH; do
    if test -d $DIR
    then
    FILTER_PATH=$DIR
    break
    fi
    done
    MODEL_PATH=""
    for DIR in $MODEL_PATH_SEARCH; do
    if test -d $DIR
    then
    MODEL_PATH=$DIR
    break
    fi
    done
    if test "x$FILTER_PATH" == "x"
    then
    echo " Cannot found CUPS filter path"
    exit
    fi
    if test "x$MODEL_PATH" == "x"
    then
    echo " Cannot found CUPS model path"
    exit
    fi
    FILTER_PROGRAMS="L_H0JDGCZAZ"
    # echo informations
    echo
    echo " start <Panasonic Printer Driver ($BUILD_CPU)> install......"
    # check and execute uninstall shell script
    if test -f $INSTALL_PATH/uninstall-driver
    then
    echo "find exist printer driver"
    echo " execute uninstall shell script now......"
    if !($INSTALL_PATH/uninstall-driver)
    then
    echo " uninstall old <Panasonic GDI Printer Driver> failed"
    echo " install driver failed"
    echo
    exit 1
    fi
    fi
    SCRIPT=`readlink -f $0`
    SCRIPTPATH=`dirname $SCRIPT`
    PWD=`pwd`
    cd $SCRIPTPATH
    # echo informations
    echo " start install files......"
    # make install dir
    mkdir -p $MODEL_PATH/panasonic/
    chown root:root $MODEL_PATH/panasonic/
    chmod 755 $MODEL_PATH/panasonic/
    mkdir -p $INSTALL_PATH/
    mkdir -p $INSTALL_PATH/bin
    mkdir -p $INSTALL_PATH/conf
    mkdir -p $INSTALL_PATH/data
    chmod 777 $INSTALL_PATH/conf
    # copy files
    # create uninstall script
    cat > $INSTALL_PATH/uninstall-driver <<\_______EOF
    #!/bin/bash
    # batch file to uninstall Panasonic Printer Driver
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
    echo " Uninstall MUST be run as root" 1>&2
    exit 1
    fi
    # echo informations
    echo
    echo " Confirmation"
    echo " <Panasonic Printer Driver> uninstall"
    echo
    echo -n " input 'y' to continue:"
    read inputval
    if test "$inputval" != "y"
    then
    echo " uninstall be canceled"
    echo
    exit 1
    fi
    # remove files
    echo " uninstall files......"
    # follow is created by install script
    _______EOF
    chmod 755 $INSTALL_PATH/uninstall-driver
    # copy lib files
    INSTALL_LIB_PATH="/usr/lib"
    RESTORECON=/sbin/restorecon
    LIB_FILES="L_H0JDJCZAZ"
    for file in $LIB_FILES; do
    cp ./lib/$file.so.1.0.0 $INSTALL_LIB_PATH/
    echo "rm -f $INSTALL_LIB_PATH/$file.so.1.0.0" >> $INSTALL_PATH/uninstall-driver
    ln -sf $file.so.1.0.0 $INSTALL_LIB_PATH/$file.so.1
    echo "rm -f $INSTALL_LIB_PATH/$file.so.1" >> $INSTALL_PATH/uninstall-driver
    ln -sf $file.so.1 $INSTALL_LIB_PATH/$file.so
    echo "rm -f $INSTALL_LIB_PATH/$file.so" >> $INSTALL_PATH/uninstall-driver
    done
    for file in $FILTER_PROGRAMS; do
    cp ./filter/$file $FILTER_PATH/
    echo "rm -f $FILTER_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    if test -f $RESTORECON
    then
    $RESTORECON $FILTER_PATH/$file
    fi
    done
    # copy ppd files
    PPD_FILES=`find ppd -name *.ppd`
    for file in $PPD_FILES; do
    cp $file $MODEL_PATH/panasonic/
    file=`basename $file`
    echo "rm -f $MODEL_PATH/panasonic/$file" >> $INSTALL_PATH/uninstall-driver
    done
    echo "rmdir --ignore-fail-on-non-empty $MODEL_PATH/panasonic" >> $INSTALL_PATH/uninstall-driver
    # copy SPC & RCT files
    DATA_FILES=`find data`
    for file in $DATA_FILES; do
    if test -d $file
    then
    mkdir -p $INSTALL_PATH/$file
    else
    if test -f $file
    then
    cp $file $INSTALL_PATH/$file
    echo "rm -f $INSTALL_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    fi
    fi
    done
    for file in $DATA_FILES; do
    if test -d $file
    then
    echo "rmdir --ignore-fail-on-non-empty -p $INSTALL_PATH/$file" >> $INSTALL_PATH/uninstall-driver
    fi
    done
    # copy tools
    cp ./panautil/L_H0JDUIZAZ $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUIZAZ" >> $INSTALL_PATH/uninstall-driver
    cp ./panautil/L_H0JDUCZAZ $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUCZAZ" >> $INSTALL_PATH/uninstall-driver
    chmod 4755 $INSTALL_PATH/bin/L_H0JDUCZAZ
    cp ./panautil/L_H0JDUIZAZ.png $INSTALL_PATH/bin/
    echo "rm -f $INSTALL_PATH/bin/L_H0JDUIZAZ.png" >> $INSTALL_PATH/uninstall-driver
    if test -d /usr/share/applications/
    then
    cp ./panautil/L_H0JDUIZAZ.desktop /usr/share/applications/
    echo "rm -f /usr/share/applications/L_H0JDUIZAZ.desktop" >> $INSTALL_PATH/uninstall-driver
    fi
    echo "rm -Rf $INSTALL_PATH/conf" >> $INSTALL_PATH/uninstall-driver
    echo "rmdir --ignore-fail-on-non-empty -p $INSTALL_PATH/bin" >> $INSTALL_PATH/uninstall-driver
    echo "rm -f $INSTALL_PATH/uninstall-driver" >> $INSTALL_PATH/uninstall-driver
    cat >> $INSTALL_PATH/uninstall-driver <<\_______EOF
    # restart
    echo " restart spooler - CUPS"
    if test -f /etc/init.d/cups
    then
    /etc/init.d/cups restart
    else
    if test -f /etc/init.d/cupsys
    then
    /etc/init.d/cupsys restart
    fi
    fi
    # echo informations
    echo
    echo " uninstall driver completed"
    echo
    echo " please use \"system-config-printer\" or \"lpadmin\" "
    echo " to remove all printers based on the driver."
    echo
    exit 0
    _______EOF
    # restart CUPS
    echo " restart spooler - CUPS"
    if test -f /etc/init.d/cups
    then
    /etc/init.d/cups restart
    else
    if test -f /etc/init.d/cupsys
    then
    /etc/init.d/cupsys restart
    fi
    fi
    cd $PWD
    # echo informations
    echo
    echo " install driver completed"
    echo
    echo " please use \"system-config-printer\" or \"lpadmin\" to add printer."
    echo
    exit 0

  • Trying to update iTunes, the installer keeps freezing at 'Running iTunes Installer Scripts'.  i've tried several different versions of iTunes and can't install any of them.  I'm stuck with Version 4!!  Help!

    I'm trying to update iTunes on my mac (Power Mac G5 running tiger), but it always freezes at 'Running itunes installer script'.  I have tried a few different versions of iTunes, but I have the same problem with all of them.  I'm stuck on version 4 (which came with my os discs)!  Help?! 

    Ok, First this link should solve the windows scripting host error. I used "Download windows script host" in a google search and it was the first hyperlink.
    http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB -95A22B832CAA&displaylang=en
    I'm assuming you are trying to run the installer from apple. What I would suggest is you download the installer manually to your desktop then launch the installer. If try to run the installer over the intertubes you may run into a problem like you did.
    Then I would uninstall itunes 8 and any software associated with it like the apple update software, quicktime, apple mobile device support. However uninstalling itunes should remove any additional software it installs. Then clean out your temp folder:
    6. Clean out your temp folders,
    a. C:\windows\temp (if one exists)
    b. C:\Documents and Settings\{username}\Local Settings\Temp
    Sometimes installers will pick up old files or won’t delete their temporary files.
    Then with a newly download installer on your desktop try launching it. Let me know if that helps.
    Here is an apple doc that help.
    http://support.apple.com/kb/TS1331
    Message was edited by: CoJeff

  • How to run custom scripts with KRunner

    Hi!
    I'd like to run my custom scripts, kept within ~/linux/bin, with KRunner. Is there any way to enter just script name instead of whole path? Something like editing $PATH in .zshrc maybe?
    Cheers
    vi3dr0

    from a quick google-trip it seems Krunner doesn't always respect $PATH.
    as a workaround found here you might [re]set you're $PATH in a script inside ~/.kde/env/ to see if that takes affect for KRunner
    my link wrote:If you would like to affect the global environment of your KDE session, and are not using a custom session, you can place files in ~/.kde/env. Files ending in ".sh" are read and executed in the same shell that is reading and executing the startkde script.

  • Run several scripts with one master script or an automator workflow?

    I have several scripts that I need to run all at once...
    Could I make a script that would run all the other scripts, then bundle everything into an application( or something similar) so all my scripts would run with just a double click...
    Any ideas?

    Yes, this is possible. Save your master script as either an application or a script bundle (whichever is most convenient). Then, save all of your subscripts inside the bundle.
    You can then load and run the scripts from your master script. The following code does that:
    set aScriptFile to load script file (path to me as string) & "Any additional subfolders" & "Script File Name.scpt"
    run aScriptFile
    Note that "path to me" will not work properly when the script is run from within script editor. It will, however, work when run from the script menu. See the following for a discussion of that:
    http://discussions.apple.com/message.jspa?messageID=2789538

  • Is it possible to have a keyboard shortcut run a script with CS6?

    I see there is an option for it to go to "other scripts" with a keyboard shortcut, but that really doesn't help much. I want it to play a specific script that is already loaded. Thanks in advance!!

    I'm working on something very similar right now.
    Written in AHK.
    so win only sorry Macsters...
    Scans a folder of your scripts and displays them in a panel (see above)
    you can click any one like a button.
    or you can eg. 3 enter.
    Panel can be dragged to where ever you want it.
    Still playing with the finishing touches and will post the finished result once I am done.
    That will be next year some time, as I am finished work for the year.
    Run, % "[Full path to]\Illustrator.exe " Scriptlocation JSName
    this is my AHK line to run the script.
    any reason for the cmd.exe section

  • Powershell: how to run vbs script with switches.

    Background: To remove a specific service, I usually log into a server, go to path c$\Program files\HP... find a specific vbs, and run it using CMD.exe.
    Now, I'm new to powershell, so I'm looking into automating this job. When I use CMD, I run cscript path\serviceinstall.vbs
    -r.
    How do I add cscript switches to powershell?
    IF
    ((test-path -path "servername\C$\Program Files\...") -eq "true")
    invoke-command -scriptblock ""servername\C$\Program Files\...\serviceinstall.vbs -r?

    1. You cannot run VBS as a scriptblock.
    2.  If youactually were to have read the full help ypu would have seen how to use the command.
    3.  Given you initial questin and the vague answers you gave there is nothing any could do to help you.
    If you do not give accurate information you will not likely get answers that are helpful.
    I recommend starting at the beginning and learning PowerShell basics.  If you had done that you would know that a script block is not a quoted string with vbscript in it or the path to a file.
    When working with any technology it is important to read the instructions carefully.  It is also useful to knowhow to do basic research on the technology you are trying to learn.
    There are 15 examples in PowerShell V2 for Invoke-Command.  Here they are as captured directly from PowerShell V2. (The is no update-help on V2. All help is built in.)
    -------------------------- EXAMPLE 1 --------------------------
    C:\PS>invoke-command -filepath c:\scripts\test.ps1 -computerName Server01
    Disks: C:, D:, E:
    Status: Warning, Normal, Normal
    Description
    This command runs the Test.ps1 script on the Server01 computer.
    The command uses the FilePath parameter to specify a script that is located on the local computer. The script runs
    on the remote computer and the results are returned to the local computer.
    -------------------------- EXAMPLE 2 --------------------------
    C:\PS>invoke-command -computername server01 -credential domain01\user01 -scriptblock {get-culture}
    Description
    This command runs a Get-Culture command on the Server01 remote computer.
    It uses the ComputerName parameter to specify the computer name and the Credential parameter to run the command in
    the security context of "Domain01\User01," a user with permission to run commands. It uses the ScriptBlock paramete
    r to specify the command to be run on the remote computer.
    In response, Windows PowerShell displays a dialog box that requests the password and an authentication method for t
    he User01 account. It then runs the command on the Server01 computer and returns the result.
    -------------------------- EXAMPLE 3 --------------------------
    C:\PS>$s = new-pssession -computername server02 -credential domain01\user01
    C:\PS> invoke-command -session $s -scriptblock {get-culture}
    Description
    This example runs the same "Get-Culture" command in a session (a persistent connection) on the Server02 remote comp
    uter. Typically, you create a session only when you are running a series of commands on the remote computer.
    The first command uses the New-PSSession cmdlet to create a session on the Server02 remote computer. Then, it saves
    the session in the $s variable.
    The second command uses the Invoke-Command cmdlet to run the Get-Culture command on Server02. It uses the Session p
    arameter to specify the session saved in the $s variable.
    In response, Windows PowerShell runs the command in the session on the Server02 computer.
    -------------------------- EXAMPLE 4 --------------------------
    C:\PS>invoke-command -computername Server02 -scriptblock {$p = get-process powershell}
    C:\PS> invoke-command -computername Server02 -scriptblock {$p.virtualmemorysize}
    C:\PS>
    C:\PS> $s = new-pssession -computername Server02
    C:\PS> invoke-command -session $s -scriptblock {$p = get-process powershell}
    C:\PS> invoke-command -session $s -scriptblock {$p.virtualmemorysize}
    17930240
    Description
    This example compares the effects of using ComputerName and Session parameters of Invoke-Command. It shows how to u
    se a session to run a series of commands that share the same data.
    The first two commands use the ComputerName parameter of Invoke-Command to run commands on the Server02 remote comp
    uter. The first command uses the Get-Process command to get the PowerShell process on the remote computer and to sa
    ve it in the $p variable. The second command gets the value of the VirtualMemorySize property of the PowerShell pro
    cess.
    The first command succeeds. But, the second command fails because when you use the ComputerName parameter, Windows
    PowerShell creates a connection just to run the command. Then, it closes the connection when the command is complet
    e. The $p variable was created in one connection, but it does not exist in the connection created for the second co
    mmand.
    The problem is solved by creating a session (a persistent connection) on the remote computer and by running both of
    the related commands in the same session.
    The third command uses the New-PSSession cmdlet to create a session on the Server02 computer. Then it saves the ses
    sion in the $s variable. The fourth and fifth commands repeat the series of commands used in the first set, but in
    this case, the Invoke-Command command uses the Session parameter to run both of the commands in the same session.
    In this case, because both commands run in the same session, the commands succeed, and the $p value remains active
    in the $s session for later use.
    -------------------------- EXAMPLE 5 --------------------------
    C:\PS>$command = { get-eventlog -log "windows powershell" | where {$_.message -like "*certificate*"} }
    C:\PS> invoke-command -computername S1, S2 -scriptblock $command
    Description
    This example shows how to enter a command that is saved in a local variable.
    When the entire command is saved in a local variable, you can specify the variable as the value of the ScriptBlock
    parameter. You do not have to use the "param" keyword or the ArgumentList variable to submit the value of the local
    variable.
    The first command saves a Get-Eventlog command in the $command variable. The command is formatted as a script block
    The second command uses the Invoke-Command cmdlet to run the command in $command on the S1 and S2 remote computers.
    -------------------------- EXAMPLE 6 --------------------------
    C:\PS>invoke-command -computername server01, server02, TST-0143, localhost -configurationname MySession.PowerShell
    -scriptblock {get-eventlog "windows powershell"}
    Description
    This example demonstrates how to use the Invoke-Command cmdlet to run a single command on multiple computers.
    The command uses the ComputerName parameter to specify the computers. The computer names are presented in a comma-s
    eparated list. The list of computers includes the "localhost" value, which represents the local computer.
    The command uses the ConfigurationName parameter to specify an alternate session configuration for Windows PowerShe
    ll and the ScriptBlock parameter to specify the command.
    In this example, the command in the script block gets the events in the Windows PowerShell event log on each remote
    computer.
    -------------------------- EXAMPLE 7 --------------------------
    C:\PS>$version = invoke-command -computername (get-content machines.txt) -scriptblock {(get-host).version}
    Description
    This command gets the version of the Windows PowerShell host running on 200 remote computers.
    Because only one command is run, it is not necessary to create persistent connections (sessions) to each of the com
    puters. Instead, the command uses the ComputerName parameter to indicate the computers.
    The command uses the Invoke-Command cmdlet to run a Get-Host command. It uses dot notation to get the Version prope
    rty of the Windows PowerShell host.
    To specify the computers, it uses the Get-Content cmdlet to get the contents of the Machine.txt file, a file of com
    puter names.
    These commands run synchronously (one at a time). When the commands complete, the output of the commands from all o
    f the computers is saved in the $version variable. The output includes the name of the computer from which the data
    originated.
    -------------------------- EXAMPLE 8 --------------------------
    C:\PS>$s = new-pssession -computername Server01, Server02
    C:\PS> invoke-command -session $s -scriptblock {get-eventlog system} -AsJob
    Id Name State HasMoreData Location Command
    1 Job1 Running True Server01,Server02 get-eventlog system
    C:\PS> $j = Get-Job
    C:\PS> $j | format-list -property *
    HasMoreData : True
    StatusMessage :
    Location : Server01,Server02
    Command : get-eventlog system
    JobStateInfo : Running
    Finished : System.Threading.ManualResetEvent
    InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca
    Id : 1
    Name : Job1
    ChildJobs : {Job2, Job3}
    Output : {}
    Error : {}
    Progress : {}
    Verbose : {}
    Debug : {}
    Warning : {}
    StateChanged :
    C:\PS> $results = $j | Receive-Job
    Description
    These commands run a background job on two remote computers. Because the Invoke-Command command uses the AsJob para
    meter, the commands run on the remote computers, but the job actually resides on the local computer and the results
    are transmitted to the local computer.
    The first command uses the New-PSSession cmdlet to create sessions on the Server01 and Server02 remote computers.
    The second command uses the Invoke-Command cmdlet to run a background job in each of the sessions. The command uses
    the AsJob parameter to run the command as a background job. This command returns a job object that contains two ch
    ild job objects, one for each of the jobs run on the two remote computers.
    The third command uses a Get-Job command to save the job object in the $j variable.
    The fourth command uses a pipeline operator (|) to send the value of the $j variable to the Format-List cmdlet, whi
    ch displays all properties of the job object in a list.
    The fifth command gets the results of the jobs. It pipes the job object in $j to the Receive-Job cmdlet and stores
    the results in the $results variable.
    -------------------------- EXAMPLE 9 --------------------------
    C:\PS>$MWFO-LOg = Microsoft-Windows-Forwarding/Operational
    C:\PS> invoke-command -computername server01 -scriptblock {param($log, $num) get-eventlog -logname $log -newest $nu
    m} -ArgumentList $MWFO-log, 10
    Description
    This example shows how to include the values of local variables in a command run on a remote computer.
    The first command saves the name of the Microsoft-Windows-Forwarding/Operational event log in the $MWFO-Log variabl
    e.
    The second command uses the Invoke-Command cmdlet to run a Get-EventLog command on the Server01 remote computer tha
    t gets the 10 newest events from the Microsoft-Windows-Forwarding/Operational event log on Server01.
    This command uses the "param" keyword to create two variables, $log and $num, that are used as placeholders in the
    Get-EventLog command. These placeholders have arbitrary names that do not need to match the names of the local vari
    ables that supply their values.
    The values of the ArgumentList parameter demonstrate the two different ways to specify values in the argument list.
    The value of the $log placeholder is the $MFWO-Log variable, which is defined in the first command. The value of t
    he $num variable is 10.
    Before the command is sent to the remote computer, the variables are replaced with the specified values.
    -------------------------- EXAMPLE 10 --------------------------
    C:\PS>invoke-command -computername S1, S2 -scriptblock {get-process powershell}
    PSComputerName Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
    S1 575 15 45100 40988 200 4.68 1392 powershell
    S2 777 14 35100 30988 150 3.68 67 powershell
    C:\PS> invoke-command -computername S1, S2 -scriptblock {get-process powershell} -HideComputerName
    Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
    575 15 45100 40988 200 4.68 1392 powershell
    777 14 35100 30988 150 3.68 67 powershell
    Description
    This example shows the effect of using the HideComputerName parameter of Invoke-Command.
    The first two commands use the Invoke-Command cmdlet to run a Get-Process command for the PowerShell process. The o
    utput of the first command includes the PsComputerName property, which contains the name of the computer on which t
    he command ran. The output of the second command, which uses the HideComputerName parameter, does not include the P
    sComputerName column.
    Using the HideComputerName parameter does not change the object. You can still use the Format cmdlets to display th
    e PsComputerName property of any of the affected objects.
    -------------------------- EXAMPLE 11 --------------------------
    C:\PS>invoke-command -comp (get-content servers.txt) -filepath c:\scripts\sample.ps1 -argumentlist Process, Service
    Description
    This example uses the Invoke-Command cmdlet to run the Sample.ps1 script on all of the computers listed in the Serv
    ers.txt file. The command uses the FilePath parameter to specify the script file. This command allows you to run th
    e script on the remote computers, even if the script file is not accessible to the remote computers.
    When you submit the command, the content of the Sample.ps1 file is copied into a script block and the script block
    is run on each of the remote computers. This procedure is equivalent to using the ScriptBlock parameter to submit t
    he contents of the script.
    -------------------------- EXAMPLE 12 --------------------------
    C:\PS>$LiveCred = Get-Credential
    C:\PS> Invoke-Command -ConfigurationName Microsoft.Exchange `
    -ConnectionUri https://ps.exchangelabs.com/powershell `
    -Credential $LiveCred -Authentication Basic `
    -scriptblock {Invoke-Command {Set-Mailbox dan -DisplayName "Dan Park"}
    Description
    This example shows how to run a command on a remote computer that is identified by a URI (Internet address). This p
    articular example runs a Set-Mailbox command on a remote Exchange server. The backtick (`) in the command is the Wi
    ndows PowerShell continuation character.
    The first command uses the Get-Credential cmdlet to store Windows Live ID credentials in the $LiveCred variab the c
    redentials dialog box appears, enter Windows Live ID credentials.
    The second command uses the Invoke-Command cmdlet to run a Set-Mailbox command. The command uses the ConfigurationN
    ame parameter to specify that the command should run in a session that uses the Microsoft.Exchange session configur
    ation. The ConnectionURI parameter specifies the URL of the Exchange server endpoint.
    The credential parameter specifies tle. Whenhe Windows Live credentials stored in the $LiveCred variable. The Authe
    nticationMechanism parameter specifies the use of basic authentication. The ScriptBlock parameter specifies a scrip
    t block that contains the command.
    -------------------------- EXAMPLE 13 --------------------------
    C:\PS>$max = New-PSSessionOption -MaximumRedirection 1
    C:\PS> Invoke-Command -ConnectionUri https://ps.exchangelabs.com/powershell `
    -scriptblock {Invoke-Command {Get-Mailbox dan} `
    -AllowRedirection -SessionOption $max
    Description
    This command shows how to use the AllowRedirection and SessionOption parameters to manage URI redirection in a remo
    te command.
    The first command uses the New-PSSessionOption cmdlet to create a PSSessionOpption object that it saves in the $max
    variable. The command uses the MaximumRedirection parameter to set the MaximumConnectionRedirectionCount property
    of the PSSessionOption object to 1.
    The second command uses the Invoke-Command cmdlet to run a Get-Mailbox command on a remote server running Microsoft
    Exchange Server. The command uses the AllowRedirection parameter to provide explicit permission to redirect the co
    nnection to an alternate endpoint. It also uses the SessionOption parameter to specify the session object in the $m
    ax variable.
    As a result, if the remote computer specified by the ConnectionURI parameter returns a redirection message, Windows
    PowerShell will redirect the connection, but if the new destination returns another redirection message, the redir
    ection count value of 1 is exceeded, and Invoke-Command returns a non-terminating error.
    -------------------------- EXAMPLE 14 --------------------------
    C:\PS>$so = New-PSSessionOption -SkipCACheck
    PS C:\> invoke-command $s { get-hotfix } -SessionOption $so -credential server01\user01
    Description
    This example shows how to create and use a SessionOption parameter.
    The first command uses the New-PSSessionOption cmdlet to create a session option. It saves the resulting SessionOpt
    ion object in the $so parameter.
    The second command uses the Invoke-Command cmdlet to run a Get-Hotfix command remotely. The value of the SessionOpt
    ion parameter is the SessionOption object in the $so variable.
    -------------------------- EXAMPLE 15 --------------------------
    C:\PS>enable-wsmanCredSSP -delegate server02
    C:\PS> connect-wsman Server02
    C:\PS> set-item wsman:\server02*\service\auth\credSSP -value $true
    C:\PS> $s = new-pssession server02
    C:\PS> invoke-command -session $s -script {get-item \\Net03\Scripts\LogFiles.ps1} -authentication credssp -credenti
    al domain01\admin01
    Description
    This example shows how to access a network share from within a remote session.
    The command requires that CredSSP delegation be enabled in the client settings on the local computer and in the ser
    vice settings on the remote computer. To run the commands in this example, you must be a member of the Administrato
    rs group on the local computer and the remote computer.
    The first command uses the Enable-WSManCredSSP cmdlet to enable CredSSP delegation from the Server01 local computer
    to the Server02 remote computer. This configures the CredSSP client setting on the local computer.
    The second command uses the Connect-WSman cmdlet to connect to the Server02 computer. This action adds a node for t
    he Server02 computer to the WSMan: drive on the local computer, allowing you to view and change the WS-Management s
    ettings on the Server02 computer.
    The third command uses the Set-Item cmdlet to change the value of the CredSSP item in the Service node of the Serve
    r02 computer to True. This action enables CredSSP in the service settings on the remote computer.
    The fourth command uses the New-PSSession cmdlet to create a PSSession on the Server02 computer. It saves the PSSes
    sion in the $s variable.
    The fifth command uses the Invoke-Command cmdlet to run a Get-Item command in the session in $s that gets a script
    from the Net03\Scripts network share. The command uses the Credential parameter and it uses the Authentication para
    meter with a value of CredSSP.
    I suggest spending som etime learning the basics.  It will save you a lot of frustration in the future.
    ¯\_(ツ)_/¯

Maybe you are looking for

  • System Monitoring - Solman 7 EHP1

    Hi Solution Manager 7.0 EHP1 / Windows 2008 / Oracle Satellite System R/3 Enterprise extn set 110 / Solaris on Sparc / Oracle I am having trouble configuring System monitoring on solution Manager. Here is what I have done Added the satellite system t

  • Preventing Loops Mail Auto Reply

    Using the Apple Mail client I've been unable to figure out how to set up an auto reply rule that also prevents message loops. Can someone help with this, please? Thanks

  • Survey fail even with SSID broadcast

    I fail the initial survey every time I try with the WRE54G. No wireless networks show up - and I get over 20 when I try with other devices. I usually have SSID broadcast disabled, but have enabled it on the WRT54G router when setting up the RE. Any a

  • Camera Raw 6.3 RC vs final release

    Does anyone have an idea how difficult it will be to replace the ACR 6.3 RC with the final version of ACR 6.3 when it is made available. I'm running a Mac PowerBook 10.6.5 and CS5

  • Active Screen Corner Customization with added hot keys fails

    Active Screen Corner Customization with added hot keys fails upon restart. So, if my lower left corner is set to activate the screen saver it works. If I add the command key to that operation it works unit I restart the machine than the hot key requi