Search Results

Search found 241 results on 10 pages for 'ps1'.

Page 6/10 | < Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >

  • when executing Powershell Script from Ruby "Can't convert true into String" error

    - by Ozie Harb
    I am trying to execute a powershell script from Ruby, I have entered the below command: scriptPath = system('powershell \"C:\\Scripts\\DB_Setup.ps1\"') The ruby Script is handling exceptions when an error is raised to stop the script as below command: rescue => ex message = "\nscript on server '#{`hostname`.strip()}' terminated unexpectedly:\n\nMessage: '#{ex.message}" raise ex Output Error: script on server 'TestDB1' terminated unexpectedly: Message: 'can't convert true into String' Thanks

    Read the article

  • How to supress Powershell window when using the -File option

    - by guillermooo
    I'm calling Powershell like so: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -noninteractive -nologo -file "C:\Users\dummy\Documents\dev\powershell\samples\test.ps1" I'm calling it from a python script, but the same problem can be observed if called via a shortcut. I thought the -NonInteractive flag would cause Poweshell to execute in a hidden window, but it doesn't. Is there a way of supressing the console window when calling Powershell from an external application? Solution based on Johannes Rössel suggestion st_inf = subprocess.STARTUPINFO() st_inf.dwFlags = st.inf.dwFlags | subprocess.STARTF_USESHOWWINDOW Popen(["notepad"], startupinfo=st_inf)

    Read the article

  • Video match anlysis

    - by Mohammad
    Hi every body I am looking forward to find an algorithm to detect a pattern in a given video file. Actually I am going to index moments in a tennis match video at which service (first kick after a goal) is shot. PS1: sorry for broken English. PS2: I DO NOT know anything about tennis except that you need a ball to play!!

    Read the article

  • Any way to specify a non-positional parameter in a powershell script?

    - by Julian Birch
    I've got the following at the start of a script Param( [string]$command, [string]$version = "1.1.0" ) This is fine, only I need for $version to not be a positional parameter, so that if you type .\script.ps1 run argument Then $args should contain argument and $version should be 1.1.0. Is this even possible? I know I can do it with a c# cmdlet, but it would be massively more convenient if I could deliver this as a single script.

    Read the article

  • Bash PWD Shortening

    - by dlibby00
    I'm looking for a bash function that will shorten long path names to keep my PS1 variable from getting excessively long. Something along the lines of: /this/is/the/path/to/a/really/long/directory/i/would/like/shortened might end up as: /t../i../t../p../to/a/r../l../d../i/w../like/shortened something that the took the path and a maximum acceptable number of characters to shorten to would be perfect for my .bashrc file.

    Read the article

  • Perl Substitution

    - by Marlin
    hi, I have a variable which stores the path on Windows. I want to replace all the \ with / in the path. for eg. $path = C:\Users\scripts.ps1 Am new to Perl and tried something like $path = s/\//// But it didnt work. can you please help me out....

    Read the article

  • UppercuT &ndash; Custom Extensions Now With PowerShell and Ruby

    - by Robz / Fervent Coder
    Arguably, one of the most powerful features of UppercuT (UC) is the ability to extend any step of the build process with a pre, post, or replace hook. This customization is done in a separate location from the build so you can upgrade without wondering if you broke the build. There is a hook before each step of the build has run. There is a hook after. And back to power again, there is a replacement hook. If you don’t like what the step is doing and/or you want to replace it’s entire functionality, you just drop a custom replacement extension and UppercuT will perform the custom step instead. Up until recently all custom hooks had to be written in NAnt. Now they are a little sweeter because you no longer need to use NAnt to extend UC if you don’t want to. You can use PowerShell. Or Ruby.   Let that sink in for a moment. You don’t have to even need to interact with NAnt at all now. Extension Points On the wiki, all of the extension points are shown. The basic idea is that you would put whatever customization you are doing in a separate folder named build.custom. Each step Let’s take a look at all we can customize: The start point is default.build. It calls build.custom/default.pre.build if it exists, then it runs build/default.build (normal tasks) OR build.custom/default.replace.build if it exists, and finally build.custom/default.post.build if it exists. Every step below runs with the same extension points but changes on the file name it is looking for. NOTE: If you include default.replace.build, nothing else will run because everything is called from default.build.    * policyChecks.step    * versionBuilder.step NOTE: If you include build.custom/versionBuilder.replace.step, the items below will not run.      - svn.step, tfs.step, or git.step (the custom tasks for these need to go in build.custom/versioners)    * generateBuildInfo.step    * compile.step    * environmentBuilder.step    * analyze.step NOTE: If you include build.custom/analyze.replace.step, the items below will not run.      - test.step (the custom tasks for this need to go in build.custom/analyzers) NOTE: If you include build.custom/analyzers/test.replace.step, the items below will not run.        + mbunit2.step, gallio.step, or nunit.step (the custom tasks for these need to go in build.custom/analyzers)      - ncover.step (the custom tasks for this need to go in build.custom/analyzers)      - ndepend.step (the custom tasks for this need to go in build.custom/analyzers)      - moma.step (the custom tasks for this need to go in build.custom/analyzers)    * package.step NOTE: If you include build.custom/package.replace.step, the items below will not run.      - deploymentBuilder.step Customize UppercuT Builds With PowerShell UppercuT can now be extended with PowerShell (PS). To customize any extension point with PS, just add .ps1 to the end of the file name and write your custom tasks in PowerShell. If you are not signing your scripts you will need to change a setting in the UppercuT.config file. This does impose a security risk, because this allows PS to now run any PS script. This setting stays that way on ANY machine that runs the build until manually changed by someone. I’m not responsible if you mess up your machine or anyone else’s by doing this. You’ve been warned. Now that you are fully aware of any security holes you may open and are okay with that, let’s move on. Let’s create a file called default.replace.build.ps1 in the build.custom folder. Open that file in notepad and let’s add this to it: write-host "hello - I'm a custom task written in Powershell!" Now, let’s run build.bat. You could get some PSake action going here. I won’t dive into that in this post though. Customize UppercuT Builds With Ruby If you want to customize any extension point with Ruby, just add .rb to the end of the file name and write your custom tasks in Ruby.  Let’s write a custom ruby task for UC. If you were thinking it would be the same as the one we just wrote for PS, you’d be right! In the build.custom folder, lets create a file called default.replace.build.rb. Open that file in notepad and let’s put this in there: puts "I'm a custom ruby task!" Now, let’s run build.bat again. That’s chunky bacon. UppercuT and Albacore.NET Just for fun, I wanted to see if I could replace the compile.step with a Rake task. Not just any rake task, Albacore’s msbuild task. Albacore is a suite of rake tasks brought about by Derick Bailey to make building .NET with Rake easier. It has quite a bit of support with developers that are using Rake to build code. In my build.custom folder, I drop a compile.replace.step.rb. I also put in a separate file that will contain my Albacore rake task and I call that compile.rb. What are the contents of compile.replace.step.rb? rake = 'rake' arguments= '-f ' + Dir.pwd + '/../build.custom/compile.rb' #puts "Calling #{rake} " + arguments system("#{rake} " + arguments) Since the custom extensions call ruby, we have to shell back out and call rake. That’s what we are doing here. We also realize that ruby is called from the build folder, so we need to back out and dive into the build.custom folder to find the file that is technically next to us. What are the contents of compile.rb? require 'rubygems' require 'fileutils' require 'albacore' task :default => [:compile] puts "Using Ruby to compile UppercuT with Albacore Tasks" desc 'Compile the source' msbuild :compile do |msb| msb.properties = { :configuration => :Release, :outputpath => '../../build_output/UppercuT' } msb.targets [:clean, :build] msb.verbosity = "quiet" msb.path_to_command = 'c:/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe' msb.solution = '../uppercut.sln' end We are using the msbuild task here. We change the output path to the build_output/UppercuT folder. The output path has “../../” because this is based on every project. We could grab the current directory and then point the task specifically to a folder if we have projects that are at different levels. We want the verbosity to be quiet so we set that as well. So what kind of output do you get for this? Let’s run build.bat custom_tasks_replace:      [echo] Running custom tasks instead of normal tasks if C:\code\uppercut\build\..\build.custom\compile.replace.step exists.      [exec] (in C:/code/uppercut/build)      [exec] Using Ruby to compile UppercuT with Albacore Tasks      [exec] Microsoft (R) Build Engine Version 3.5.30729.4926      [exec] [Microsoft .NET Framework, Version 2.0.50727.4927]      [exec] Copyright (C) Microsoft Corporation 2007. All rights reserved. If you think this is awesome, you’d be right!   With this knowledge you shall build.

    Read the article

  • How to set root public folder permissions in Exchange 2010.

    - by DanieL
    I am currently running Exchange Server 2010 on Windows Server 2008 R2. I have a user that I would like to be able to create/delete public folders in the root public folder. How do I give this user permission to do this? So far I have tried adding the user to the Public Folder Management, Domain Admins, and Administrators groups, and running the following scripts in the powershell: Add-PublicFolderAdministrativePermission -Identity "\" -User "Username" -AccessRights AllExtendedRights -InheritanceType SelfAndChildren This appears to have done something, but the user still cannot create public folders in the root public folder. AddUsersToPFRecursive.ps1 -toppublicfolder \ -User "Username" -Permissions Owner This gives me an access denied error. Any ideas?

    Read the article

  • How to override the default dir alias in Powershell?

    - by Ashwin
    I wanted to see colorized filenames when I typed dir in Powershell. So, I added the Set-ChildItemColor function from here to my profile file. I also added this line at the end of the profile file to override the dir alias: Set-Alias dir Get-ChildItemColor Now, when I open Powershell, I get this error: Set-Alias : The AllScope option cannot be removed from the alias 'dir'. At C:\Users\joe\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:82 char:10 + Set-Alias <<<< dir Get-ChildItemColor + CategoryInfo : WriteError: (dir:String) [Set-Alias], SessionStateUna uthorizedAccessException + FullyQualifiedErrorId : AliasAllScopeOptionCannotBeRemoved,Microsoft.PowerShe ll.Commands.SetAliasCommand What is this AllScope? How do I remove that option to get colorized dir?

    Read the article

  • SSH broken after hostname change on EC2-hosted Ubuntu

    - by dimadima
    I changed my instance's hostname using the hostname utility and then set it in /etc/hostname so that the new name survives reboot. My main motivation was for differentiating between instances at the prompt using the \h format in PS1. EDIT I also changed permissions on my home directory. I made my home directory group writeable. END EDIT Now I can no longer SSH into the machine. The short of it is the error Permission denied (publickey). Running ssh -v, the more verbose output is: debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/dmitry/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/dmitry/.ssh/ec2key.pem debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey). Should I have done something after changing the hostname? Now I can't get into the instance! :(

    Read the article

  • Different color prompts for different machines when using terminal/ssh?

    - by bcrawl
    I have 5 machines I constantly ssh into to do work. Its getting increasingly frustrating when I am issuing wrong commands on wrong boxes. Luckily I havent done anything bad yet. I wanted to know if there is any hack which I can hardcode which will display my prompt in different colors based on the machine I am ssh into? Such as blue for desktop1, purple for laptop, red for server etc? Is this possible? Currently I am using this command export PS1="\e[0;31m[\u@\h \W]\$ \e[m " taken from here http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ but it obviously doesnt work across ssh. Also, if you have any other cool bash tips for helping me ease my sight will be wonderful. I got this tip which colors the man pages. http://linuxtidbits.wordpress.com/2009/03/23/less-colors-for-man-pages/

    Read the article

  • VIM zsh, bash and colors in command line on Ubuntu

    - by Jacek Wysocki
    I have problem with VIM command line when calling system commands. e.g. !ls, all command output colors aren't parsed by VIM. My system is Ubuntu 12.04 LTS with VIM 7.3.429 from Ubuntu repositories. Is there any workaround for this problem? EDIT: My vimrc file :!echo $TERM in VIM returns : dumb EDIT2: I found a simple workaround but it's not perfect if [ "$VIM" ] && [ "$TERM" = "dumb" ] then # For gvim's monochromatic :shell PS1='\n\u@\h \w\n\$ ' unalias ls unalias grep fi (It's working on bash)

    Read the article

  • How do I figure out what is changing the userWorkstations attribute in Active Directory?

    - by Martin
    I just took over the IT for a medium sized business with a three domain controllers (2003/2008 Standard) and whenever I create a new user, after some time the user account cannot log into most machines on the network. I have traced this back to the "Log On To..." area becoming populated with a small list of machines. Even when I set the option to all computers, this list comes back after some time. I started hunting for vbs and ps1 scripts with the word "workstations" in them on all domain controllers to see if there is some kind of script to blame, but I have thus far come up empty handed. Is there a known software suite that can cause this (Microsoft Forefront, etc)? How can I figure out what is causing this list to change?

    Read the article

  • Mac OS X bash prompt bug?

    - by Memo
    I am trying to set my bash prompt to display the time and current directory in bold: export PS1="\[\e[1m\][\A] \w \$ \[\e[0m\]" This does apparently work, but when I use the command history (ctrl-r), after finding the command I was searching for and pressing enter, this line is not displayed correctly. Here is an example: [21:58] ~/Wyona/svn-repos/zwischengas $ (reverse-i-search)`ta': tail -F logs/log4j-cnode1.log becomes, after pressing enter: [21:58] ~/Wyona/svn-repos/zwischengas $ -F logs/log4j-cnode1.log Of course, this is not "really" a problem, since the command does work correctly, but it is still annoying. Does anybody know why this happens? And, more importantly, how to prevent/fix it? Thanks, Memo

    Read the article

  • Custom prompt doesn't work on Mac's terminal

    - by mareks
    I like to use a custom prompt (current path in blue) on my unix machine: export PS1='\[\e[0;34m\]\w \$\[\e[m\] ' But when I try to use it on Mac's terminal it doesn't work: it fails to detect the end of the prompt and overwrites the prompt when I type commands. This also happens when I'm inputting a long command where it wraps over the same line instead of starting a new line. I don't understand why this is the case since I use bash on both machines. Any suggestions on how to remedy this?

    Read the article

  • Problem with OWA search. Mailstore catalogues

    - by Anthony
    Dear All, I have trawled for the last few days but have not been able to come up with a solution; any help would be much appreciated. Exchange 2007 STD on Windows 2003 64Bit and users report search not working in OWA. So I first check indexing is enabled on the mail stores Get-MailboxDatabase |ft Name,IndexEnabled which all report true, So I try a test Test-ExchangeSearch [email protected] Which is a false -1 Ok, So I run the reset - resetsearchindex.ps1 this works and the event log reports the stores being crawled and finished. BUT- My complete catalogue data is 300kb - LOL! I wish! Obviously all tests fail so I do it manually; Stop indexing service, Delete catalogues. Restart Still no dice, This is where I’m up to, I have tried many different variations of the above and being through oodles of MS documentation Has anyone got any ideas?

    Read the article

  • Load login shell inside user cronjob

    - by sa125
    I'm trying to run a rake task using a scheduled cronjob. My crontab looks something like this: 0 1 * * 1-7 /bin/bash -l -c "cd ~/jobs/rake && rake reports:create >> ~/jobs/logs/cron.log" Ruby on my account is provided by RVM, which is loaded via ~/.bashrc (before the no-interaction check): # load RVM env [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm # If not running interactively, don't do anything [ -z "$PS1" ] && return # ... rest of logic Time and again, this task fails to run since RVM isn't loaded when the task is called (uses system's /usr/bin/ruby instead), and gem dependencies are missing. How can I make crontab load my shell environment before executing my scheduled jobs? thanks.

    Read the article

  • bash starts replacing the characters on the current line insead of moving over to the next line

    - by Lazer
    I use bash shell $ bash --version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. $ Sometimes, when typing a command on the prompt that is pretty lengthy and does not fit in the current line, instead of displaying the extra characters on the next line, bash starts again on the current line.. replacing the characters that were there and making a mess. what should happen : |---------------------------------------------| | $ my big long command takes a lot of argumen| | s and does not fit in a single line | | | |---------------------------------------------| what happens instead : |---------------------------------------------| | s and does not fit in a single linef argumen| | | | | |---------------------------------------------| The issue is intemittent If I resize my shell window to really small width, normal behaviour is restored Does anyone have any idea what is happening here? $ echo $TERM xterm $ echo $PS1 \[\e[30m\][\t]\[\e[0m\]\[\e]0;\w\a\]\[\e[30m\][\W]$ $

    Read the article

  • dmenu doesn't set environment variable as per my .bash_profile when running Emacs

    - by proofit404
    I have following ~/.bash_profile [[ -f ~/.bashrc ]] && . ~/.bashrc and ~/.bashrc ### Check for shell interactivity. if [[ $- != *i* ]] ; then return fi ### Nyan-cat prompt. PS1="\`if [ \$? = 0 ]; then echo \[\e[35m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\` \$ " ### PATH export PATH=$PATH:$HOME/bin So when I run emacs from terminal all OK. When I start it with dmenu (getenv "PATH") and exec-path variable doesn't contain ~/bin directory. When I do it in xfce with xfrun4 command with same bash configuration all seams to work too. What is the problem with dmenu?

    Read the article

  • rvm doesnt work when specifiying the path...?

    - by jtzero
    when typing in the path to the rvm it doesnt work $which rvm /usr/local/bin/rvm $ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] $/usr/local/bin/rvm use 1.8.7 Using /usr/local/rvm/gems/ruby-1.8.7-p302 $ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] #now w/o the path $rvm use 1.8.7 Using /usr/local/rvm/gems/ruby-1.8.7-p302 $ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] $whereis rvm rvm: /usr/local/bin/rvm /usr/local/lib/rvm /usr/local/rvm .... /etc/bash.bashrc .... if [[ -n "$PS1" ]]; then ... [[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm" anyone seen this?

    Read the article

  • SSH broken after homedir permissions and hostname change on EC2-hosted Ubuntu

    - by dimadima
    I changed my instance's hostname using the hostname utility and then set it in /etc/hostname so that the new name survives reboot. My main motivation was for differentiating between instances at the prompt using the \h format in PS1. EDIT I also changed permissions on my home directory. I made my home directory group writeable. Now I can no longer SSH into the machine. The short of it is the error Permission denied (publickey). Running ssh -v, the more verbose output is: debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/dmitry/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /Users/dmitry/.ssh/ec2key.pem debug1: read PEM private key done: type RSA debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey). Should I have done something after changing the hostname? Now I can't get into the instance! :(

    Read the article

  • Why does sharepoint claim not enougth disk space for backup when there is lots availalbe?

    - by Mr Shoubs
    I'm trying to run the following command: Backup-SPFarm -Directory E:\Backups -BackupMethod full -Verbose However it errors saying there isn't enough disk space... the backup will be about 1.8Gb in size, I have 27.52GB free, so why does it think I need 30Gb? VERBOSE: Leaving BeginProcessing Method of Backup-SPFarm. VERBOSE: Performing operation "Backup-SPFarm" on Target "SHAREPOINTSERV". Backup-SPFarm : There is not enough disk space. Free additional space on your h ard disk and then try again. Approximate amount of space needed: 30.12 GB. Amou nt of space free on disk: 27.52 GB. At E:\Backups\Script\BackupSharePointFarm.ps1:3 char:14 + Backup-SPFarm <<<< -Directory E:\Backups -BackupMethod full -Verbose + CategoryInfo : InvalidData: (Microsoft.Share...mdletBackupFarm: SPCmdletBackupFarm) [Backup-SPFarm], SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletBackupFa rm VERBOSE: Leaving ProcessRecord Method of Backup-SPFarm. VERBOSE: Leaving EndProcessing Method of Backup-SPFarm.

    Read the article

  • How can I open PowerShell via AutoHotkey?

    - by Ryan
    I'm running AutoHotkey 1.0.48.05 on Windows 7. I'd like CTRL-ALT-P to open PowerShell. This is what I have so far: ^!p:: Run %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe Return This is the error I get: File C:\Users[username]\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details. I've already set the execution policy to RemoteSigned by opening PowerShell ISE as Administrator and running Set-ExecutionPolicy RemoteSigned. (See http://technet.microsoft.com/en-us/library/ee176949.aspx) How can I get around this problem?

    Read the article

  • Why does PsExec hang after successfully running a powershell script?

    - by Matt
    The script is fairly straight forward. Simply tries to start a bunch of windows services. Execution locally works fine when on the target machine. The script is actually executing fine as well when done via PsExec, it just never returns until I hit the "enter" key on my CMD prompt. This is a problem, because this is being called from TeamCity, and it makes the Agent hang waiting for PsExec to return. I've tried the following: Adding an exit and exit 0 at the end of the Powershell script Adding a < NUL to the end of the PsExec call, per the answer in this SF question Adding a > stdout redirect This is how I am actually calling psexec: psexec \\target -u domain\username -p password powershell c:\path\script.ps1 No matter what I do, it hangs until I the locally on the cmd prompt. After I hit enter, I get the message: powershell exited on target with error code 0.

    Read the article

  • My powershell script wont save a file when run using Task Scheduler, do I need to specify a specific argument?

    - by EGr
    I have a script that downloads a temporary Excel file, copies parts of it to a new file, and saves it to a specific location on the network. The problem I'm having is that the new file is never created/saved. If I run the script locally (through cmd.exe, powershell, or powershell ise), it WILL save the file locally, or to the network. If I try running the script via a schedule or on-demand via Task Scheduler, the temporary file is created, but the final document is never created or saved. Is there a specific argument I need to pass, or anything I could be doing wrong? This is the command I'm currently using: powershell.exe -file C:\path\to\my\powershell\script\thescript.ps1 Since it calls environment variables, and other variables relative to the scripts positon, I also set "Start in" to C:\path\to\my\powershell\script\

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >