Login script to viserver with reading-host name, user name and password assecurestring

Hello

I'm connecting to a server vCenter or ESX host at the beginning of another script script, so that it is generic, I want to invite the user for the name of the server, the user name and the password and pass it to connect-viserver. I would really like to password entry to be looked at by and that you can see how to do it, but if it is stored as a secure string, it does not pass in the connect-viserver command correctly. If I remove the assecurestring - it connects very well.

$vc = read-host "enter the name of vCenter or ESX host name."

$us = read-host "enter user name".

$pw = read-host "Enter password" - assecurestring

to connect-viserver $vc - user $us - pass $pw

...

I tried to add the line:

$pw = $pw | out-string

But it is not convert it.

How to read a string safe in the command?

Thank you

Dan

Or use the script that I entered info ' Read-Host ' Encrypt

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • Fill the CSV file with the host name and the name of data store

    Hello

    How can include the hostname in my output csv file?

    The following code adds the name of the data store but not the host name:

    import-csv hosts | % {get-vmhost-name $_.name} | Get-Datastore. SELECT name.

    Export-csv ESX - Datastore.csv - notypeinformation - useculture

    How to watch your entry CSV file?

    If it's something like

    Name

    ESX1

    ESX2

    Do it like this

    &{foreach($esx in (Get-VMHost -Name (Import-Csv host.csv -UseCulture | Select -ExpandProperty Name))){    $esx | Get-Datastore |    Select @{N="VMHost";E={$esx.Name}},Name}} | Export-Csv report.csv -NoTypeInformation -UseCulture
    
  • Cannot add a host with the host name in VC

    Hi all

    Nice day.

    I just finished the installation of 2 servers esx4.0, Vartual Center Server and domain controller server in my home test harness. I added both the host esx server in DNS records. then I tried to add hosts to VC by using the host name, then I get the error message like

    "Unable to contact the (xxxxx) host specified. "the host may not be available on the network, a network cofiguraion problem can exhist or that management on this host services may not respond.

    I checked that all are ping and found no network configuration problem. I am able to add a host using the IP address, but not with the host name. I checked services in VC, all services run very well. Earlier I never had this problem.

    Please help me if someone has the solution.

    Thanks in advance

    Kind regards

    Suresh

    I would check the article below under additional information

    http://KB.VMware.com/kb/1027672

  • Base - Add the user name and password in script?

    Hello

    Scripting is not my thing, I run the script below in order to get the use of the data store space and it requires user name and password for vcenter, how do I add it in the script, then I can run as a scheduled task on my Windows Server that has installed PowerCli?

    # These are the properties assigned to the table via the ConvertTo-HTML cmdlet.

    $tableProperties = '< style >.

    $tableProperties = $tableProperties + "TABLE {border-width: 1px;}. border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + "TH {border-width: 1px;}. padding: 5px; border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + "TD {text-align: center;} '. border-width: 1px; padding: 5px; border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + ' < / style >.

    ##The script will automatically connect to the server if necessary. The $server variable must

    #be changed if the server name changes.

    $server = "192.168.132.1".

    If (!) () to connect-viserver $server - ErrorAction SilentlyContinue). IsConnected)

    {

    Write-Host "connection to the server: ' $server

    to connect-viserver $server - ErrorAction SilentlyContinue err - ErrorVariable

    If ($Err)

    {

    Write-Host "Connection to the server error, please check server name." - ForegroundColor Red

    breaking

    }

    Write-Host "Full" - ForegroundColor Green

    }

    # cmdlet to retrieve information from data warehouses.

    # variable $rep stores all the information for each data store.

    $rep = @)

    Get-Datastore. Sort-Object-property name. {ForEach-Object

    $Datastore = $_

    $Report = "" | Select-Object - property Datastore, CapacityGB, FreeSpaceGB, PercFreeSpace

    $Report.Datastore = $Datastore.Name

    $Report.CapacityGB = [math]: tour ($_.) CapacityMB / 1 KB, 0)

    $Report.FreeSpaceGB = [math]: tour ($_.) FreeSpaceMB / 1 KB, 0)

    $Report.PercFreeSpace = [math]: Round (((100 * ($_.))) FreeSpaceMB)) / ($_.) (CapacityMB)), 0)

    $rep += $Report

    }

    # Formats date, file name, etc. #.

    #Write - Host "Generating report".

    $date = get-date

    $datefile = get-date - uformat ' %d-%m - Y % - hour %M ' %S

    $filename = "C:\vmware\powercli\reports\VMwareDatastoreUsage_" + $datefile + ".htm".

    # Generates vsphere datastore usage report #.

    Write-Host "Full" - ForegroundColor Green

    Write-Host "Generating datastore usage report".

    $rep | Sort PercFreeSpace | ConvertTo-HTML-head $tableProperties - body ' < th > < font style = ' "color: #000000 '" > < big > < b > VMware Datastore using < /b > < / big > < / font > < /th > | Out-file $filename

    Write-Host "Full" - ForegroundColor Green

    Write-Host "usage of your data store report has been saved to: ' $filename

    ##Send email with attached generated report #.

    #Write - Host "sending email with report:" $filename + "attached".

    Send-MailMessage-to "vmware-reports < . " [email protected] >"-subject 'vSphere datastore use' - to ' Andy White < [email protected] > "-body" VMware report attached: use of the data store "- attachment $filename - high - dno onSuccess, onFailure - smtpServer 192.168.13.3

    The connection is made in this line

    SE connect-VIServer $server - ErrorAction SilentlyContinue err - ErrorVariable

    You can add the user and password parameters of the cmdlet Connect-ViServer . But you want to have this info hardcoded in the script?

    An alternative is to use the credentials store.

    There are other alternatives to store the credentials.

  • Why my firewall only use the domain user name and password for login and enable passwords, not a different password enable as do it my switches? RADIUS config looks the same...

    / * Style definitions * / table. MsoNormalTable {mso-style-name: "Table Normal" "; mso-knew-rowband-size: 0; mso-knew-colband-size: 0; mso-style - noshow:yes; mso-style-priority: 99; mso-style-parent:" ";" mso-padding-alt: 0 to 5.4pt 0 to 5.4pt; mso-para-margin: 0; mso-para-margin-bottom: .0001pt; mso-pagination: widow-orphan; do-size: 10.0pt; do-family: "Times New Roman", "serif" ;} "}

    Question:

    Firewalls Cisco requires that one level of password, i.e. the domain user name and password are used for logging as that to reach the global configuration mode.

    Background:

    We have several network devices Cisco, put in place who authenticate to our Windows using NPS (Windows 2008 R2) DC. Switches we have implemented the function exactly as we would wish that they need your domain user name and password to connect to the device. Then they require a separate password when you use the enable command, it is stored in Active Directory:

    Switches:

    User name:domain-username

    Password:password-field

    SWITCH >Activate

    Password:Enable-password - to-Active Directory

    SWITCH #.

    Firewalls (as they are now):

    User name:domain-username

    Password:password-field

    Firewall >enable

    Password:password-field

    FIREWALL #.

    With the firewall, however, they require your domain user name and password first and then your domain password again when you use the enable command. I want to reuse the firewall to use the level that currently switches enable password rather than the password of domain. The appearance of the current configuration as follows:

    Current configuration of the switch:

    AAA new-model

    AAA authentication login default local radius group

    AAA authentication enable default group enable RADIUS

    AAA authorization exec default local radius group

    AAA - the id of the joint session

    ACCT-port of 1645 auth-port host 192.168.0.1 Server RADIUS 1646

    Server RADIUS ports source-1645-1646

    RADIUS server key 7 1234abcd

    Current configuration of the firewall:

    RADIUS protocol AAA-server DC01

    AAA-server DC01 (outside) host 192.168.0.1

    authentication AAA ssh console LOCAL DC01

    Console to enable AAA authentication LOCAL DC01

    1234abcd keys

    Any help would be great, thanks!

    You must use GANYMEDE + instead of RADIUS for this.

    Here, you can use command sets in the results section of the policy.

  • Cannot focus Skype name and password in the login screen

    I use Skype for a long time now and used the automatic connection whenever I start my computer. Today, I accidentally disconnected from Skype. Now, I can focus my Skype name and password in the login screen. I'm having the same problem with fields in Internet Explorer 11. Does anyone know a solution to this problem? I use Windows 7 Professional.

    For me, that did the trick.
    http://community.Skype.com/T5/Windows-desktop-client/Skype-won-t-sign-in-can-t-enter-password/m-p/41...

  • Connect you to Skype does not work with the correct user name and password

    I tried to login with my correct user name and password, but received the error: unable to connect to Skype.

    So, I reset the password and can log on the Skype website.

    Tried to connect to Skype and the same error: unable to connect to Skype.

    I use

    Mac OS X Version 10.9.5.

    Skype 5.8.0.1027.

    OK, I think I thought about it on my own. I had not used Skype for some time. I just DLed the latest version and here is my connection works fine. Hope this helps you.

  • When I try to share files between two computers Windows XP with SP3, I'm invited for a user name and password on both.

    I set up a home network with 2 computers with XP Media Center 2002 SP3 1 and 1 with XP Home SP3 2002 can see computers on the network and the Ping works. But I wonder a user name and password. seems to come from the computer. Do not see documents shared to the Media Center computer.

    original title: file sharing problems.

    As far as I can remember, Media Center is XP Pro with additional multimedia functions.  What follows is a very old post by MS MVP Malke, but the Council is still sound:

    File sharing / print

    Excellent, comprehensive, but easy to understand article on sharing files/printer under Vista. Contains information about sharing printers and files, and the folders:

    http://TechNet.Microsoft.com/en-us/library/bb727037.aspx

    For XP, start by running the Network Setup Wizard the on all machines (see warning in section A below).

    Problems sharing files between computers on a network are usually caused by 1) a misconfigured firewall or a firewall neglected (including a dynamic firewall in a virtual private network); or (2) inadvertently run two firewalls such as the firewall of Windows and a third-party firewall. and/or (3) do not have accounts to the same users and passwords on all computers in the workgroup. (4) tries to create actions where the operating system does not.

    A. configure the firewall on all machines to allow traffic to local area network (LAN) as being approved. With the Windows Firewall, it means which allows file sharing / print on the Exceptions tab normally run the XP Network Setup Wizard will take care of this for these machines. The only "witch hunt", it will turn on the XPSP2 Windows Firewall. If you are not running a third-party firewall or you have an antivirus with "Internet Worm Protection" (like Norton 2006/07) which acts as a firewall, you're fine. With a third-party firewall, I usually set up the allocation of LAN with an IP address range. E.g. would be 192.168.1.0 - 192.168.1.254. Obviously you would substitute your correct subnet. Do not run more than one firewall. DON'T STOP FIREWALLS; CONFIGURE THEM CORRECTLY.

    (B) to facilitate the Organization, put all computers in the same workgroup. This is done from the System applet in Control Panel, the computer name tab.

    C. create the counterpart of the user accounts and passwords on all machines. You do not need to be logged into the same account on all machines and assigned to each user account passwords can be different; accounts/passwords just need to exist and to match on all machines. DO NOT NEGLECT TO CREATE PASSWORDS, EVEN IF ONLY OF SIMPLE. If you want a machine to boot directly to the desktop (a particular user account) for convenience, you can do this. The instructions on this link work for XP and Vista:

    Configure Windows to login automatically (MVP Ramesh) -.

    http://WindowsXP.MVPs.org/Autologon.htm

    D. Si one or more of the computers is XP Pro or Media Center, turn off Simple file sharing (Folder Options > view tab).

    E. create share as you wish. XP Home does not share the users directory or the Program Files, but you can share folders inside those directories. A better choice is to simply use the Shared Documents folder. See the first link above for more information on Vista sharing.

    F. you have the job of file sharing (and tested by exchanging a file between machines), if you want to share a printer connected locally to one of your computers, share of this machine. Then go to the printer mftr Web site. and download the latest drivers for the correct system. Install them on the target machines. The printer must be collected during the installation procedure. If this isn't the case, install the drivers and then use the Add Printer Wizard. In some cases, printers must be installed as local printers, but it is outside this response.

  • Configuration to use windows mail for mobile and iphone without having to sign in with the user name and password each time?

    Hello, I have a windows mail account on my laptop and I also have an iphone. I registered my account companys on both laptop and iphone problem is when you configure receive it and send messages on mobile then you can not send screws iphone.

    If you set up the password for the e-mail account on your iphone, it will stop and request your username and password on your laptop.

    How is it possible to use both systems without having to login with user name and password every time?

    Hoslo

    Both could be "collision" in that they are both trying to access the mail server at the same time.  Make sure that they do not check too often.  Try to disable a device when checking with each other and see if that makes a difference.  Also with WinMail, if you have a POP3 account, make sure that under Tools | Accounts | Mail | Properties | Advanced that you have configured to leave a copy of messages on the server, so the phone can bring too, that normally it will delete messages on the server when it downloads.

    Steve

  • I set up Windows 7 to use fingerprint or password to logon. How can I get rid of the fingerprint logon and back by connecting with just the user names and passwords?

    I have configured Windows 7 to use the fingerprint or password login screen. I can't footprint material and do not want to use, but can not find where you reconfigure to return by connecting with just user profile names and passwords.

    Hello

    Welcome to the Microsoft Vista answers Forum!

    You can try the steps below and check if the problem is resolved.

    1. click on start.

    2. click on Control Panel.

    3. click on hardware and sound.

    4. now click biometric devices.

    5. now click on biometric parameters.

    6. now you should check biometrics off the coast of the option button.

    7. click on save changes.

    8. click on close.

    Now search for the question.

    Learn more about the biometric device, you can visit the link provided below.

    http://TechNet.Microsoft.com/en-us/library/dd759228.aspx

    Thank you, and in what concerns:

    I. Suresh Kumar-Microsoft Support.

    Visit our Microsoft answers feedback Forumand let us know what you think.

  • [MAF] How to get the user name and password after login?

    Hi Experts,

    I have a call to REST where it requires identification information of the user (uname and password) to identify the data that belongs to who.

    Authentication has been made with OAuth.

    I believe that there is an API to get the user name and password in the CRG

    See you soon,.

    Hendry

    Hello.

    You don't need to manipulate the credentials yourself in code. MAF will propagate the logon cookie or inject the identification information in the HTTP header if cookies are not supported.

    To do this, you must select the purchase option of cookie from the server connection Include in REST in the dialog box create a connection Login MAF , such as discussed here:

    http://docs.Oracle.com/middleware/maf210/mobile/develop/MAF-securing.htm#ADFMF23732

    In addition, you must attach the policy of security appropriate to the connection, as explained here:

    http://docs.Oracle.com/middleware/maf210/mobile/develop/MAF-Web-services.htm#ADFMF23697

    Best regards

    Frédéric Desbiens

    Senior Product Manager

    Mobility and Cloud oracle

    Twitter: @BlueberryCoder

    blog: http://blogs.oracle.com/blueberry

  • How device Orchestrator properly resolve its host name and IP address?

    Hello.

    Someone knows how to make good DNS resolution for device Orchestrator in order to solve its own (full FQDN) host name and IP address according to DNS records?

    The problem is with the methods "System.resolveIpAddress ()" and "System.resolveHostName ()".

    The 'resolveIpAddress()' method returns the same so called IP with static IP address assigned to this device. And returns the domain the host's FULL name when it is called with 127.0.0.1.

    So when I call "System.resolveIpAddress ('192.168.1.50')", it returns "192.168.1.50" instead of FULL domain name.

    When I call "System.resolveIpAddress ('127.0.0.1')", it returns "vco.local.lan".

    The 'resolveHostName()' method returns 127.0.0.1 when it is called with FULL domain name or host name.

    When I call 'System.resolveHostName ('vco.local.lan')' or '('vco') System.resolveHostName' it returns 127.0.0.1 in both cases.

    utility 'nslookup' launched from the console device even work properly return FQDN by entering the IP and the return of the appropriate IP (192.168.1.50) when you enter the FULL domain name.

    Thank you.

    SSH to your device or access to the console and log in as root...

    Then, edit your file/etc/hosts

    -Remove any mention of your domain name FULL and hostname in there, the only things you'll want to go in the sense of:

    127.0.0.1 localhost

    Possibly restart the network service (perhaps not necessary, I did it on my own)

    After doing this, my phone began to show the fqdn when I chose the correct IP address in the configuration.

  • In the Photos of El Capitan how to record a double published in a separate with its own name and the ID file file?

    In the Photos of El Capitan how to record a double published in a separate with its own name and the ID file file?

    Only by exporting - with Photos (and iPhoto and Aperture) - you can have several versions of an image by duplicating the image (control - D), but this does not create an image file separated until you export - it creates a separate edit list in the database that applies to the original when you watch or export the photos

    Photos as it were its predecessors is a non-destructive control Digital Asset Manager (DAM) which does not any changes to files in the database but built a list of validation

    LN

  • Skype account is always available with the old user name and password after you bind Microsoft account

    https://support.Skype.com/en/FAQ/FA12081/how-do-i-sign-in-to-Skype-for-Windows-desktop-with-my-micro...

    After my new account Microsoft a link to my original Skype account, I'm still able to sign into account newly merged with the old Skype account username and password. Of course, I am also able to connect to the account merged with the Microsoft Mail and as well password account.

    My question is this, is this a planned security measure? As far as I know, support faq suggested using the Microsoft account to connect to the newly merged account. The support page is in the link given.

    I thought that once the merger of Skype accounts both Microsoft, the only method to sign the merged account is using the Microsoft account only. Please enlighten me on this matter. Thank you.

    This works as expected. When you link a Microsoft account with Skype account name, you should be able to connect to Skype, either by using Skype or Microsoft account name. Two connection options will lead to the same account.

  • At the opening of the PSC 3.6.3 I wonder to authenicate a user name and password to go "fasTun. In my view, that it is a virus, which I can't find, or eradicate. This coincided with my computer located in Canberra, Australia, thinking about my ISP is in F

    See the detail in the original question. Here is the text of the dialog box that appears, with the username and password fields: "the fastun.com:7000 proxy request a user name and password. The site says: "fasTun. "This means that I am unable to use the multiannual financial framework. I uninstalled PSC and PSC re-installed and the same thing happens. The problem arose after that I had been surfing the Net and goes on a German site. From that moment, my internet has become very slow. When I ran "speedtest.net" my computer would fairc Frankfurt (Germany), instead of Canberra, in Australia! Can you please help?

    This has happened

    Each time Firefox opened

    Following my fact a system restore to a point before the computer slows down. From there on, I was unable to use the multiannual financial framework to connect to Web sites. The problem is not using Windows Internet Explorer 8, or is there a problem with the speed of downloads.

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; .NET CLR 1.0.3705; .NET CLR 1.1.4322;. Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152 .NET CLR 3.5.30729)

    Check the proxy settings under Tools-> Options-> Advanced - tab network, the settings button.

    You probably want no Proxy, if it is set to anything else.

    See https://support.mozilla.com/en-US/kb/Options+window+-+Advanced+panel#Connection_Settings_Dialog

    http://fasTun.com (a record required web Accelerator / anonymizer) indicates that it is a kind of add-on Firefox. Do you see a relevant in tools-> Modules-> Extensions? Try turning it off.

    If you are not sure who this is, try to disable all questions to troubleshoot Firefox in Safe Mode .

Maybe you are looking for