Using a SecureString password in an automated script?

Hello all,
I've been having issues getting a secure string to work with an automated script.
Basically, a piece of software we use can accept commands via powershell/command shell but requires a password for the commands to be run.
I've spent a fair amount of time researching the ConvertFrom and ConvertTo methods and tried without success. (When trying to use the ConvertFrom/To methods the software gives back incorrect password errors).
Can anyone please assist?

Hi Jonathan,
you can simply use the $SecurePassword variable from Basty's example (if you need a secure string) and pass this as Password. Please note though, this will only work if the account writing the credentials to file is also the same account used to read it
from file.
If you need to encode it for another account (like local system), you can use the
Encrypt-Credential function-script (The example on how to retrieve a clear-text password in memory will also work with Basty's $cred object).
On a final note:
Encrypted or not, try to avoid writing passwords down if you can somehow avoid it. If possible, assign permissions to the account running the task, if the service you are accessing supports windows authentication and privileges.
Cheers,
Fred
There's no place like 127.0.0.1

Similar Messages

  • Ruby, Cucumber and Watir Automation Scripting Basics

    Greetings my friends,Thank y'all all within the community and the moderators for being so cool and willing to help so quickly! Just wanted to lead in with that. So I could really use some help with this basic automation script that I am running. I am trying to select the search bar on Google.com and enter some text. I have gotten some help from friends but they were stuck as well. But it learning this I was hoping to get some help from the experts and just ask these questions that I have because Google ain't got shit!1) How to select the search field and enter text. # Mine looks something like this I've tried xpath, different values, id's classes.require 'ruby'require 'water-webdrivrer'browser Browser::browser.new :firefoxbrowser.goto 'http://google.com'$browser.text_field( :value = 'Search').set('google search')2)When I inspect...
    This topic first appeared in the Spiceworks Community

    Hi Sona Shetty,
    As far as I know, VB script and Excel VBA are different functions.
    Office VBA is used to extend Microsoft Office. I think your issue is more related to VB script debug, I recommend you post your question to Script forum:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Is there any Profile option available to encrypt and use APPS password Oracle Application Host script

    @Hi, How do we encrypt APPS password usage  in Oracle Application Host script and still let it be used in encrypted format (eg.$1, $FCP_LOGIN should not show plain text password).
    Appreciate the process along with any Profile available to place this control.
    Concurrent Program Setup Option SECURE/ENCRYPT controls $1, $FCP_LOGIN respectively, but Developer still has access to view/log the APPS Password.
    Can we have a System profile or an Apps DBA level Setup to encrypt and use the APPS/Password.
    Thanks in Advance
    Lakshmi

    Are you linking the host script to fndcpesr? E.g.:
    Host script defined with prog extension:
    XXSCRIPT.prog
    Move it to relevant dir:
    $XX_TOP/bin
    Create a soft link to fndcpesr
    ln -s $FND_TOP/bin/fndcpesr XXSCRIPT

  • Unable to use Automator scripts

    Ever since migrating to Leopard 10.5.1 from Tiger, I have not been able to use any of my Automator scripts. They don't work. I did create a script to rename my files and every time I use it I constantly get an Applescript error -1700.
    What's going on here and what should I do?

    Can you post the script in question?
    Have you opened the workflow in Automator and set each step to show results and run the from there to see where it fails?
    The error is "Can't make some data into the expected type." This means it is trying to implicitly convert something to something else. Some changes to the applescript code may not allow the implicit conversion that was working before. If you see what is failing, post the code, I might be able to figure it out.

  • Automated script for deploying, removing, install again the WSP using stsadm command line

    Hi,
    Am having a requirement in my  staging and  prod  env. to add, install,retract and remove wsp.
    In my dev env i used to perform with  Visual Studio ,so i didnt  face any issues regarding retracting and removing the wsp from solution store.
    But in my staging and prod since i dont hav VS installed, i would like to have a automated script[ NOT in POWERSHELL] using stsadm command line tool which adds the solution from a folder [say D:\DeployWSPs in staging and Prod] to the solution
    store  and installed onto a particular web application [  NOT "All WebApplications"].
    and if  the wsp already exists , i need to retract it & remove from solution store and add it and install again.
    can someone pls help me with the  automated script .also if  the folder contains multiple WSPs how can i doa  for each loop [ iterate through  wach ".wsp"  file and perform install/...task].
    i know stsadm -o adddsolution, deletesolution,m retractsolution etc. But the issue is that customer asked me to do this ina automated fashion.  manually entering all these commands is a  cumbersome activity.
    note: when i used powershell on 2 / 3 occasions, the wsp was retracted successfully,but failed to successfully remove from the
    soln store.
    so i thought i will depend upon on stsadm again like old version of SP since its supported.
    Das

    I would recommend you to use Power Shell so that you can do the automation easily. You can use
    power shell for earlier version of SharePoint as well. 
    Look why removing the solution is getting failed. May be you are trying to remove before the solution is retracted. Wait for retract and remove the solution. Refer to the following post for more information
    http://www.codeproject.com/Articles/570011/PowerShellplus-plusWaitplusforplusRetractplus-fpl
    http://consultingblogs.emc.com/mattlally/archive/2011/03/29/sharepoint-server-2010-multiple-solution-deployment-script.aspx
    Cheers,

  • Problem in uploading attachment files through automation scripts using Oracle Application Testing Suite(OATS)

    I am using OATS tool for writing automation scripts to test a web-based application . But I am facing problem when the requirement is to upload any file from the system to that web application .
    Actually the behavior of the script or I guess of OATS is inconsistent as the attachment file is getting upload sometime and
    fails to do so at the other time .
    I have observed a strange case also ,i.e whenever i am executing the scripts while sharing my system screen on webex meeting
    then the attachment upload results in failure . What can be the proper solution for doing file upload using automation script ??

    Can you please check whether the sync has been taken care before performing the upload operation. If the sync is taken care then the upload should work always

  • Opening iTunes using an Automator script

    I'd been using Automator in conjunction with iCal to open streaming audio in iTunes v 9.x. Since upgrading to iTunes v 10, the Automator script won't work. I get the error message "The action "Get Specified iTunes Items' could not be loaded because the application iTunes is the wrong version. Try upgrading the application to version 4.6 or later" Anyone have a clue as to what's wrong, and how to fix it?

    Both of these links seem to lead back to the question I asked.
    Okay. And both of those links acknowledges there is a problem and offer at least a temporary solution.
    Knowing that the conflict is between Automator and iTunes 10, the question becomes: Doesn't Apple test new versions of its software with ITS OWN other apps before release?
    I imagine they do but it's kinda irrelevant. If it doesn't work correctly, it doesn't work correctly.
    Send suggestions to Apple here ->
    -> Apple Feedback - Automator
    -> Apple Feedback - iTunes

  • Can the automated script recored in Empirix be used in OATS 8.5 and Above ?

    Can the automated script recored in Empirix be used in OATS 8.5 and Above
    Regards,
    Sujata Mishra

    Sujata
    Yes e-Tester scripts are supported at the moment, however they will not be in the near future.
    Regards
    Alex

  • Creating ABAP function module in using an automated script

    I wish to create very simple ABAP function modules through an automated script. Is there any way I can do this?

    [http://code.google.com/p/saplink/]
    Greetings,
    Blag.

  • Service failure automation script

    Hi All,
    I have configured the below mentioned code on our prod servers services to send email notifications when ever a service fails. 
    On Error Resume Next
    strComputer = "USDFW16AS61"
    Const cdoSendUsingPickup = 1
    Const cdoSendUsingPort = 2
    'Function block to dynamically retrieve the file size of the report file.
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Authentication type used for SMTP server.
    'We are currently using 0, cdoAnonymous
    Const cdoAnonymous = 0 'Do not authenticate
    Const cdoBasic = 1 'basic (clear-text) authentication
    Const cdoNTLM = 2 'NTLM
    'Creates message subject, we are using variables declared earlier in the script
    Set objMessage = CreateObject("CDO.Message")
    objMessage.Subject = "CMS Production service iwutild is stopped"
    'Sets the From address
    objMessage.From = """Support DL"[email protected]
    'Sets the destination, or TO address
    objMessage.To = [email protected]
    'Sets the CC address. Only used for testing purpose at the moment. Should be commented out when in use.
    'objMessage.CC = ""
    'Sets the message body, the actual email message. Variables are used in the message which was declared earlier.
    objMessage.TextBody = "Dear Administrators, the xyz service is now in STOPPED state." & vbCRLF & vbCRLF & "Please do not reply to this message as it was sent to you by an automated Script."& vbCRLF & vbCRLF &
    "Thanks and regards"
    'objMessage.TextBody = "Dear Application Administrators,"  & vbCRLF & ""& vbCRLF & ""& vbCRLF &
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    'Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "servername"
    'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
    'Your UserID on the SMTP server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusername") = ""
    'Your password on the SMTP server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = ""
    'Server port (typically 25)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    'Use SSL for the connection (False or True)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    objMessage.Configuration.Fields.Update
    '==End remote SMTP server configuration section==
    'Sends the message using code.
    objMessage.Send
    This script is able to send notification only for the respective service that I have configured it to Run upon failure.
    My requirement now is that the script should be able to detect out of the 6 app services that are down & should append the email body with the name of that service & send an email.
    I understand Wscript.argument(0) can be of use but not able to use it. Could you kindly help?
    Thanks,
    Pankaj
    P.S: I am not a developer, so kindly bear with me :)
    Pankaj Dhoot

    Hi Pankaj,
    To solve the script issue, I would like to recommend you to post in the Visual Studio Languages forum for more effective support:
    http://social.msdn.microsoft.com/Forums/en-US/home?category=vslanguages
    or The Official Scripting Guys Forum!
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG&filter=alltypes&sort=lastpostdesc
    Thank you for your understanding.

  • Set local password with secure startup script

    Since CPassword has been deprecated by MSFT, I need a secure method to set the password of the local administrator on all workstations. The workaround script that MSFT provided in
    the kb article won't work because I have no control over when a computer is on or off. Hence my desire to use a startup script. I logon script would be fine too, but I suspect that wouldn't work since the
    end users don't have access to set these passwords.
    I can set the password with these commands:
    $objUser = [ADSI]"WinNT://./LocalAdmin"
    $objUser.SetPassword("NewPassword")
    but that exposes the password in the script in plain text, which is worse than the CPassword problem that MSFT "fixed."
    So, how can I do this same thing and use a predetermined password without putting it into a logon/startup script in plain text?
    Thanks in advance!
    Blog /
    Facebook / Twitter

    Ha, that's also what I'm doing right now.  The simplest way to eliminate most of the threats, in my opinion, is:
    1) move the script to a separate file share (since Domain\NetLogon is definitely a main target for hackers), and
    2) set the permissions to allow Domain Computers Read Only.  This will eliminate most of the threats.
    If you're still not comfortable having the password in plain text, use the native PS Encryption (Convertto-SecureString and
    Convertfrom-SecureString) and use your own key.
    Dave Wyatt has a very informative post on this topic:
    http://powershell.org/wp/2014/02/01/revisited-powershell-and-encryption/comment-page-1/
    Remember this is not a 100% hacker proof solution, but should be good enough to keep away the novices.

  • Writing commands to get specific data channels in the output report via script or automated script generation..

    In my project I have to make certain calculation and then get the data plotted in the given report template. I am using automated script for this. My script is doing all the calculations and then it not selecting and drag-dropping the selected channels on the report template. Its saving the blank report template.
    I am struggling to get the data for specific channels plotted by using the script. I need the selected channels to be plotted on this report template and then get it saved.
    Any help will be deeply appreciated. Thanks
    Solved!
    Go to Solution.

    Hi LaxG,
    Brad is absolute right. It is possible to create your whole layout via script.
    If you have loaded  the example report layout you can copy these lines to create a new line in your plot. This is the recommended object oriented way.
    call Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Add(e2DShapeLine, "anyName")
    Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape.XChannel.Reference               = "[1]/Zeit"
    Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape.YChannel.Reference               = "[1]/Geschwindigkeit"
    For performance reasons it's recommended to use the it like this.
    dim oLine
    set oLine = Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape
    oLine.XChannel.Reference               = "[1]/Zeit"
    oLine.YChannel.Reference               = "[1]/Geschwindigkeit"
    Like Brad mentioned it is much easier, that you have a stored template of your report with all setings and customisations already done.
    You open this layout file and have stored the names of your calculated channels. When you are doing this with a script they always have the same name and belong to the same group.
    Now you can customize the references of the line items.
    Kind Regards,
    Philipp K.
    AE | NI Germany

  • Dropbox automator script no longer working with Mavericks

    Hi,
    I use two versions of the following shell script (found on the net), launched by automator, to set up two Dropbox accounts :
    Since upgrading to Mavericks, the script hangs when execution is requested. If the execution is then stopped and then requested a second time, the script terminates normally. Anyone have any idea why this might be (I am no expert of either shell scripts or automator) ?

    ok then do this. Once you have your first Dropbox account set up try the following steps:
    1. Create a folder named "Dropbox-second" anywhere you like.
    2. Open terminal, write "bash" and press enter.
    3. paste the line below and press enter. (Dont close the terminal window)
    HOME=$HOME/Dropbox-second /Applications/Dropbox.app/Contents/MacOS/Dropbox &
    4. A second dropbox instance will open requiring you to sign in. Go ahead sign-in and then click advanced and point to the "Dropbox-second" folder you created.
    5. Close the terminal window and close the second instance of the dropbox from the topbar. (Click on the icon -> Click on the gear -> Quit Dropbox)
    6. Now open AppleScript Editor and paste the following
    do shell script "HOME=$HOME/Dropbox-second /Applications/Dropbox.app/Contents/MacOS/Dropbox > /dev/null 2>&1 &"
    7. Click run and you will see the second icon of Dropbox in the topbar appear again.
    8. Click stop and then from file save this as an application anywhere you like. Give a name like "DBMore" or anything you like.
    9.Now to make sure everytime you login to your account the second dropbox starts, go to system preferences->users & groups-> select the current user-> click login items on the right->click the + sign to add "DBMore" application you created.
    That's it you're done.
    10. If you want to be able to differentiate between the two dropbox accounts click on the second dropbox icon in the topbar -> click the gear -> click preferences -> general -> use black and white menu bar icons.
    Enjoy! Hope this really helps

  • How do I schedule an automator script to run at a certain time every day?

    How do I schedule an automator script to run at a certain time every day?
    This used to be done through iCalendar and this option is no longer available.
    How do I do this?
    --Kenoli

    Kenoli Oleari1 wrote:
    How do I schedule an automator script to run at a certain time every day?
    This used to be done through iCalendar and this option is no longer available.
    How do I do this?
    --Kenoli
    You can use lauchd to run the script.
    Here's an example of an Automator App that I have scheduled to run at 7am daily:
    You would save this as com.yourname.plist and put it the the Folder: ~/Library/LaunchAgents/ (then log out and back in, or reboot)
    (To run a workflow, change open to automator)
    (A nice GUI launchd editor is Lingon)
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>Label</key>
              <string>com.tonyt.EventReport</string>
              <key>ProgramArguments</key>
              <array>
                        <string>open</string>
                        <string>/Users/Tony/Library/Scripts/Events Report.app</string>
              </array>
              <key>StartCalendarInterval</key>
              <dict>
                        <key>Hour</key>
                        <integer>7</integer>
                        <key>Minute</key>
                        <integer>0</integer>
              </dict>
    </dict>
    </plist>

  • I need an automator script to play a folder of movies

    I have a folder of quicktime movies. I have a Mac Mini with Lion. I have a TV. I need an automator script to grab the list of movie files from the folder and play them full-screen, one-by-one and then loop through the process to continue playing them, unattended, all day.
    I cannot get the proper steps in automator to accomplish this (seems to me it should be easy) job.
    Any ideas?
    Doug Jansen
    Tokyo

    Dave,
    Thanks for the tip. I didn't know that Quick Look would display a folder of files one-by-one. Once I set the first file to full screen, the rest also played full screen one after the other. Now I need a way to automatically launch Quick Look, set full screen and loop. This site http://automator.us/leopard/downloads/index.html has an automator action that uses Quick View, but on my Lion machine it just displays the first movie and only the first frame of the movie. It stops at that point.

Maybe you are looking for

  • Windows 8 won't let me install firefox

    Hello, I am trying to install Tor, the latest browser bundle, and when I do I get a message that "This app can't run on your PC". Why? Is it because I use Tor on my smart phone and recently allowed my smart phone access to my computer through my fire

  • How do I load a ringtone without syncing

    OK - so I know this issue has been asked in hundreds of different forums but after reading all and trying each I am no further than where I started. So I downloaded a silent ringtone (for telemarketers) in .m4r format. I dropped it into iTunes 10.8 (

  • BAPI_NETWORK_MAINTAIN for UPDATE ACTIVITY-CN 307-You are not authorized to

    Hi all, sorry for disturb, I have a problem and I don't understand why.... I use BAPI_NETWORK_MAINTAIN with simple code. I have tried with SE37 with the same values and it correctly update the activity. without error messages. but with the same value

  • Cannot export text using Acrobat 9 Pro

    Hello all, I have a .pdf file that I want to export as text using Acrobat 9 Pro. File / Export menu appears to offer this,  as does the help.   But mousing over the arrow to the right of the Export / Text menu brings up no options.  I can export as .

  • What are "recovered files",

    What are "recovered files", These files show up mysteriously in my trash everyday