Running function with "Write-Host" and redirect output to file does nothing.

Hello,
I created this function:
function TicketSolutionInformation {
Write-Host "User has been created." -ForegroundColor Green
TicketSolutionInformation | Out-File -filepath ("123" + ".txt") -append
but the file 123.txt is always empty. Why ?

Write-Host will write text to console, not pipepeline so you'll always get nothing.
Consider changing function to this:
function TicketSolutionInformation {
Param(
[switch]$Passthru
Write-Host "User has been created." -ForegroundColor Green
if($Passthru){
"User has been created."
}TicketSolutionInformation -Passthru | Out-File -filepath ("123" + ".txt") -append

Similar Messages

  • TS3212 im running XP with all firewalls and pop up blockers off. Ive tried using chrome, firefox, and IE. no download starts and im redirected to the thank you screen, please help!!!!!!!!!!!!!!!

    im running XP with all firewalls and pop up blockers off. Ive tried using chrome, firefox, and IE. no download starts and im redirected to the thank you screen, please help!!!!!!!!!!!!!!! Ive read all related articles, aswers and solutions but cant seem to get tunes to download?

    Ive tried from my PC, and ive tried from another which runs Vista. Both pc's were tried using firefox, IE and chrome,and both had firewalls off and pop-ups allowed completely (I basically turned off all security). I checked for 3rd party software which could also cause "blocks" but all 3rd party software were eliminated. I even tried stopping and restarting windows installer in "computer management; services, services". Still no luck..... This is the first time that ive struggled downloading Itunes. The reason im trying to download itunes is because im attempting to restore my iphone 4.....

  • Help with the HOST and START, forms 6i

    Hi i like open to image with de Host and Start in Forms 6i.
    For example Host('start '||:path||'', NO_SCREEN ); -> is correct if the path is c:\ ... but if the path is more longer with space in white for example C:\Documents and settings ... i put the quotes "C:\Documents and settings ..." but Doesn't open the image, another window (MSDOS) open... :S

    Hello,
    Try this:
    Host('cmd /c START "" "' || :path || '" ');Francois

  • Itunes won't play any cd i put in the drive (macbook pro). I am running paralells with windows 7 and have disables media player so that didn't help

    itunes won't recognize/play/import any cd i put in the drive. I am also running paralells with windows 7 and have disabled media player. any suggestions?

    I have the same problem.
    On launch itunes works fine.
    If I let it play through a full album of songs unatended, when I return it respondes, but will not play music. I can browse my collection, but when i click the play button, press the space bar with a track selected or double cclick a track it will not play. A restart of iTunes solves the problem temporarily.

  • I'm having lots of trouble finding semi-decent equipment at an affordable price. I would like to start a podcast with two hosts and I have a macbook pro that i purchased in april 2011. any suggestions?

    I'm having lots of trouble finding semi-decent equipment at an affordable price. I would like to start a podcast with two hosts and I have a macbook pro that i purchased in april 2011. any suggestions?

    I should keep it simple - if you start getting involved with mixers and multiple microphones you will find the cost escalating  alarmingly. If you can get yourself a decent microphone and spend some time doing tests to find the best way of balancing the voices you should be able to get acceptable results. You can't plug an ordinary microphone directly into a Mac - you would need a mixer or a preamplifier - so it's probably worth looking at USB mics. I don't know what cost range is available, and you would have to check that they would work with your Mac. Otherwise you will need an ordinary moving-coil mic and probably a USB audio converter which can accept a microphone - look at the Roland site.

  • I was running KeyPassFox with Firefox 8.0.1, but the plugin does not work in the new release (9) . Is there a way to restore my previous version with all of my bookmarks intact? I do not mind if I have to restore the plugins myself.

    I was running KeyPassFox with Firefox 8.0.1, but the plugin does not work in the new release (9) . Is there a way to restore my previous version with all of my bookmarks intact? I do not mind if I have to restore the plugins myself.
    The plugin shows on the list as enabled and functioning, yet the tool does not show on the toolbar. It would appear that I need to restore the previous version of Firefox and wait until a newer release of the plugin is available before upgrading the browser.

    I copied the iTunes file from the external drive and it's in both places.  I thought all I would need is the iTunes program (which I downloaded to new computer) and my iTunes library file.  There must be something else that's missing.  My iTunes library looks the same on the new computer as it does when I open it on the external drive.  If I click on an iTunes library song from my new computer, it will only play if I have the external drive plugged in.
    My back-up drive is a mess.  I have multiple copies of music, video, photo, and document files and I don't know how that happened. ={  Obviously, I don't know how to back up stuff properly and there are back-up files extending over a 6- to 8-year period.  I think all I did was just drag and drop the main folders from the back-up drive to the same main folders on the C: drive.  Also (and I'm kind of fuzzy on this) Windows used to automatically save music files in a folder within my document files (which makes no sense to me).  As my Jewish friends would say, "Oy Vey!" 

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • HT1386 The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    If the answer to the above question is "yes", FIRST, set up a backup of your new computer before you do anything else so the next time your computer breaks you will not be in the same situation. Backup solutions are numerous and inexpensive, and there is absolutely no excuse in the Third Millennium not to have one.
    Then see this tip: https://discussions.apple.com/docs/DOC-3141

  • Maybe its just me but verizon had my rebate for a month and some change and  still haven gotten it i got this contract on july 10, and my samsunsung galaxy s4 does nothing but shut off on me constatntly and they wont even help..any suggestions because im

    maybe its just me but verizon had my rebate for a month and some change and  still haven gotten it i got this contract on july 10, and my samsunsung galaxy s4 does nothing but shut off on me constatntly and they wont even help..any suggestions because im looking into a lawsuit now so aggravating..my phone is def on a blank sceen right now

    JCLouis, 
    We saw your story and are very worried about what we read! This isn't like us at all and we are here to help sort it all out. We recommend calling the Rebate Center to check on the status. Their number is 1-800-457-0864.
    We can help you right here with your phone! How often does it turn off? Is it just that the screen goes black or does it completely power down? Also, does it start back up by itself if it does power down?
    SarahO_VZW
    Follow us on Twitter @VZWSupport

  • When safari is in full screen mode and I move the mouse to the top of the screen to bring up the menu bar and the bookmark bar, it does nothing.  Is anyone else having this issue?

    When safari is in full screen mode and I move the mouse to the top of the screen to bring up the menu bar and the bookmark bar, it does nothing.  Is anyone else having this issue?
    Thanks

    I just tested that since I hardly ever use full screen mode, this was the first time since I upgraded to Mountain Lion, and it worked fine for me.
    Try shutting Safari down and see if that changes anything.
    If that doesn't change anything, try shutting down and then rebooting.
    Allan

  • Why, after using my Apple ID and Pswd, and clicking on the arrow, does nothing happen -- cannot access iCloud?

    Using Windows Vista on my PC, why, after using my Apple ID and Pswd, and clicking on the arrow, does nothing happen -- cannot access my iCloud calendar?

    i'm having the same problem

  • [solved] run dmenu with custom aliases and functions

    Is it possible to run my custom bash aliases and functions with dmenu?
    My aliases are placed in ~/.bash_aliases and my functions are in ~/.bash_functions.
    I source them in my ~/.bashrc through:
    Functions
    if [ -f ~/.bash_functions ]; then
    . ~/.bash_functions
    fi
    # Aliases
    if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
    fi
    Last edited by orschiro (2013-12-27 08:41:40)

    No problem!... sorry, I was about to post an "improved" version, but it breaks support for functions, doh!
    EDIT: finally got it to work as I wanted Sorry, zsh stuff is gone from mine, I don't use it -- feel free to borrow the improvements for your version though!
    v1.4 Changes:
    - removed unnecessary if statements
    - removed unnecessary 'source' command
    - added some logic to see if the command is a real program, or an alias/function - this saves spawning bash shells that aren't needed
    v1.5 TODO list:
    - add some "history" feature so that commonly used commands appear first in the list
    #!/bin/bash
    cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
    if [ -d "$cachedir" ]; then
    cache=$cachedir/dmenu_run
    else
    cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
    fi
    cmd=`(
    IFS=:
    if [ -f ~/.bash_aliases ]; then
    aliases=( ~/.bash_aliases )
    fi
    if [ ~/.bash_functions ]; then
    functions=( ~/.bash_functions )
    fi
    if stest -dqr -n "$cache" $PATH || stest -fqr -n "$cache" "$aliases" || stest -fqr -n "$cache" "$functions"; then
    stest -flx $PATH
    source $aliases
    alias | awk -F '[ =]' '{print $2}'
    compgen -A function
    ) | sort -u | tee "$cache" | dmenu "$@"
    else
    dmenu "$@" < "$cache"
    fi
    )`
    if [ -f ~/.bash_aliases ]; then
    if [ ! -z $(which $cmd) ]; then
    exec $cmd &
    else
    echo -e "source ~/.bash_aliases \n $cmd" | bash -O expand_aliases &
    fi
    fi
    Last edited by dennis123123 (2014-04-21 10:09:39)

  • Printing output from select-object with write-host

    $lastdir = Get-ChildItem 'C:\Users\' | select Name | sort | select -last 1 name
    write-host $lastdir
    results printed as @{Name=guptal}
    how do I get it just to print the "guptal" part only? How do I access this object values?

    Hi,
    Add -ExpandProperty to your Select-Object.
    EDIT: Or use $lastdir.Name
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • Run Report with Pass Number and Varchar Lexical Parameter values

    Dear Sir/Madam
    Due to an urgent change required to a report I would most appreciate it if you can please advise me if it is possible to get this report working by either passing in multiple lexical parameters or one signle lexical parameter when calling the SRW.RUN_REPORT command with the following methods:
    Firstly: When calling report with a run_no and spr_cd passed in through one lexical:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_PARAM=RUN_NO=TO_NUMBER(28) AND SPR_CD=SUPP1
    Both with a TO_NUMBER and without, whereby I attempt to do a SUBSTR within the query of the called report to derive the RUN_NO Oracle Reports fails to accept the SUBSTR.
    Secondly: I am now trying to call the with passing two lexical parameters into the report as follows:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_RUN_NO=||TO_CHAR(lv_run_no)|| CP_L_SPR_CD=||lv_spr_cd;          
    NOTE: The above is an output of the actual command line and not what is passed into the command line, thus the quotes are missing. Please also note that the report is running fine with the only a hard coded RUN_NO value PASSED without the SPR_CD.
    Unfortunately this is also causing issues as the RUN_NO is a number and as you know you can only pass in strings.
    Your urgent help is required on this matter please as our client is expecting a solution this afternoon.
    Hope to hear form you soon.
    Kind regards
    Andrew Mason

    Dont Worry I've worked it out...

  • How to restart an entire J2EE Cluster - With multiple hosts and instances

    I am looking for a definitive answer on the right way of Restarting an SAP Enterprise Portal CLUSTER without an ABAP stack.
    Currently the process is to use ssh into each box and either jcmon pf=<profile> then restart instance, or ssh into each host and run startsap/stopsap on each.
    Is there a better way?
    -Tim

    Hi,
    Please find the below SAP notes to understand the startup sequences.
    897933  Start and stop sequence for SAP systems
    936273  sapstartsrv for all platforms
    I would recommend you to check the below SAP link for more information.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60e24f7b-1ba1-2b10-c0a0-e514b855624b?quicklink=index&overridelayout=true
    Regards,
    Naveen.

Maybe you are looking for