Help with People profile

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 11 months ago.

  • Author
    Posts
  • #5337

    by msalamon at 2012-12-11 11:11:27

    I created my profile –msalamon–but I cant edit any of the sections—-email,aboutMe, fullname,-twitter-linked in-ect. when I run the script-the contect states invalid or missing username or password. but when I check the $results object, I see that the usrname and password are correct—pleas help...

    Here is the script I'm trying to run:

    # —————————————————–
    # Updated 12 November 2012
    # —————————————————–
    # Modified Version (by @mikefrobbins) of the PowerShell.org/People Profile Creation Script
    # Based off of Original Script by @concentrateddon at https://powershell.org/people/script.txt
    # Thanks @jeffhicks for putting single quotes in your bio
    # —————————————————–
    # Control + M to open / close all regions in the PowerShell ISE

    # —————————————————–
    #region Want to make a valuable contribution?
    < # Want to make a valuable contribution? What you'll find in this file
    are just bare-bones examples. Why not create a PowerShellPeople module
    that provides PowerShell cmdlets, with comment-based help and enumerated
    parameter values, for all of these functions? Contact @concentrateddon
    on Twitter when you've got it working and we'll make it available to the
    public!

    #>
    #endregion

    # —————————————————–
    #region Setup Prerequisites
    # —————————————————–

    < #
    Set the interface URL
    HTTPS is a possibility in the future but not right now
    so please don't use your 'standard' password in the below.
    #>

    $uri = 'https://powershell.org/people/interface.php'

    < #
    Set your username and password for convenience. Note that your username
    is how people will access your page. It should consist of letters, numbers,
    and maybe dashes. Leave out all other characters, most of which are illegal
    in a URL.

    This has nothing to do with your PowerShell.org forums username, although it's
    fine if you use the same name.

    In this example, the user's page will be accessible from powershell.net/
    and powershell.org/people/

    Note that there is currently no password recovery mechanism. So don't lose your
    password. We only store a portion of a hashed password, not the whole thing,
    and not in cleartext.
    #>

    $credential = Get-Credential -Message "Enter a Username & Password for your PowerShell.org people site account – WARNING: This Password is Transmitted in CLEAR TEXT!"

    < #
    Everything is basically Invoke-WebRequest calls with a dictionary of
    keys and values that the server will understand. The response you get back
    will have a Content field that tells you how it went. These examples all
    expand that Content field so that you can see the results.
    #>

    #endregion

    # —————————————————–
    #region Create Your Profile Page
    # —————————————————–

    < #
    The following command creates your profile. Note that fullname is required,
    and is your first and last name as it will be displated on your page. Pages
    with fake names will be disabled and you will be shunned by all. This portion
    of the script (create your profile page) should only be run once.
    #>

    Write-Host "Creating user"
    $request = @{'verb'='create';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'fullname'="Matt Salamon"}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Check the interface version number.
    # —————————————————–

    < #
    This example script is designed for version 1.9
    #>

    $request = @{'verb'='getversion'
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Populate Your Profile
    # —————————————————–

    < #
    The next set of examples populate elements in your bio, like your "about"
    and your social networking info. The username/password here is your
    PowerShell People profile username and password, which you established above.
    We don't need your Twitter, Facebook, or other account passwords.

    We suggest adding your e-mail to your profile. This gets stored as an encrypted
    hash so that spambots can't find it, but it enables us to send you
    a new password if you forget yours.
    #>

    # —————————————————–
    #region Add Email Address
    # —————————————————–

    Write-Host "Adding Email"
    $request = @{'verb'='addbio'
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='email';
    'data'='matt.salamon@cfl.rr.com'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add AboutMe (bio)
    # —————————————————–

    < #
    Add About (add bio text; HTML tags not permitted)
    Any text is allowed, but no HTML tags. Don't use < and > in here,
    or they'll be interpreted as HTML and probably break your page.
    Avoid using ampersand & also.
    #>

    Write-Host "Adding AboutMe Text"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='about';
    'data'="I Like Powershell–teach me some cool stuff."}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Gravatar
    # —————————————————–

    < #
    Add Gravatar (adds your photo; pass your Gravatar-registered e-mail address)
    Pass a cleartext e-mail that's registered with Gravatar.com.
    Note that all we store is a hash of your email not the cleartext

    Gravatar is free, and you can sign up at http://www.Gravatar.com. We display your
    photo at 80×80, so try and provide a graphic that will look good at that size.
    #>
    < #
    Write-Host "Adding Gravatar"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='gravatar';
    'data'='me@mrpowershell.com'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap
    #>
    #endregion

    # —————————————————–
    #region Add PowerShell.org Discussion Forum
    # —————————————————–

    < #
    If you're on the PowerShell.org discussion forums, add a link to your
    user page. To do this, log into the site and click on your username
    in one of your posts. You should be taken to a page with a URL like this:

    memberlist.php?mode=viewprofile&u=774

    You need the numeric portion of that – 774, in this example.
    #>
    < #
    Write-Host "Adding PowerShell.org"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='powershellorg';
    'data'='774'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap
    #>
    #endregion

    # —————————————————–
    #region Add Twitter
    # —————————————————–

    < #
    Add Twitter
    The 'data' for twitter is your handle, without the @ sign (add handle @mrpowershell as 'mrpowershell')
    #>

    Write-Host "Adding Twitter"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='twitter';
    'data'='mattsalamon1'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Facebook
    # —————————————————–

    < #
    Add Facebook (add myname for http://facebook.com/myname)
    You can only do this if you've set up a username for Facebook,
    e.g., if you can get to your profile via http://facebook.com/mrpowershell,
    then mrpowershell is what you pass to 'data'
    #>
    < #
    Write-Host "Adding Facebook"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='facebook';
    'data'='mrpowershell'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap
    #>
    #endregion

    # —————————————————–
    #region Add LinkedIn
    # —————————————————–

    < #
    Add LinkedIn (add myname for http://linkedin.com/in/myname)
    The 'data' for LinkedIn is your username, http://linkedin.com/in/mrpowershell
    means you'd use mrpowershell
    #>

    Write-Host "Adding LinkedIn"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='linkedin';
    'data'='matt-salamon'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Google+
    # —————————————————–

    < #
    Add Google+ (add numeric portion of profile URL: https://plus.google.com/116428076245542010619/posts)
    ~~~~~~~~~~~~~~~~~~~~~
    Look in your Google+ profile page and get the numeric part of that URL
    to pass to 'data'
    #>

    Write-Host "Adding Google+"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='google';
    'data'='113973195831912764413'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add TechNet Script Center Repository
    # —————————————————–

    < #
    If you contribute to the TechNet Script Center Repository, you can add a link to your
    contributions. You'll need your URL-encoded username. For example, "Mr PowerShell" is
    "Mr%20PowerShell" as seen in this URL:

    http://gallery.technet.microsoft.com/sc ... PowerShell
    ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

    The easiest way to get this is to go to http://gallery.technet.microsoft.com/scriptcenter, find one of your
    contributions, and click on your NAME to pull up a URL like the one above. These may be case-sensitive.
    #>
    < #
    Write-Host "Adding TechNet"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='technet';
    'data'='Mr%20PowerShell'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add PoshCode.org
    # —————————————————–

    < #
    If you contribute to PoshCode.org, you can link that, too. You'll need your username. For example, in this URL:

    http://poshcode.org/author/Mr%20Powershell

    The username is "Mr%20Powershell". You can find this by going to PoshCode.org and clicking on your username to see a list of
    your contributions, and then looking in the browser's address bar. These may be case-sensitive.
    #>
    < #
    Write-Host "Adding PoshCode"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='poshcode';
    'data'='Mr%20Powershell'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Links
    # —————————————————–

    < #
    The following sections populate your tabs. These are meant to be for
    things having to do with YOU... YOUR sites, YOUR appearances, YOUR
    projects, etc.

    Each has a TYPE:
    website: for blogs, websites, etc.
    publication: for magazine articles, books, etc.
    project: for code projects and other ongoing works
    appearance: for conference appearances, podcast guest spots, etc.
    member: for user group or association memberships

    Each has a URL:
    http://whatever/I/am/Linking/To

    And each has a DESCRIPTION:
    This can be any short phrase. Avoid & and < and > characters. For an
    "appearance" you should include the date of the appearance.

    Keep everything here PowerShell-focused. It's not that we don't care
    about your Toastmasters award... oh, wait, that's it. We don't care. 🙂
    #>

    # —————————————————–
    #region Add Websites (Sites)
    # —————————————————–
    < #
    Write-Host "Adding Website"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='website';
    'url'='http://mrpowershell.com';
    'name'="Mr PowerShell Blog";
    'description'="Blog Site about PowerShell, PowerShell, and more PowerShell"}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Publications
    # —————————————————–

    Write-Host "Adding Publication"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='publication';
    'url'='http://powershellbooks.com';
    'name'='My PowerShell books';
    'description'='A list of books'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Memberships (Groups)
    # —————————————————–

    Write-Host "Adding Membership"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='member';
    'url'='http://powershellgroup.org';
    'name'='PowerShell Virtual UG';
    'description'='Never actually attended a meeting. Sad.'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Projects
    # —————————————————–

    Write-Host "Adding Project"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='project';
    'url'='http://codeplex.com/powershellcx';
    'name'='PowerShell Community Extensions';
    'description'='I have nothing to do with this'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Appearances
    # —————————————————–

    Write-Host "Adding Appearance"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='appearance';
    'url'='http://powerscripting.wordpress.com';
    'name'='PowerScripting Podcast';
    'description'='My guest spot on 1/11/2011'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    # —————————————————–
    #region Add Recommendations (Links)
    # —————————————————–

    < #
    A recommendation is another type of link you can add. These ones
    aren't about YOU per se – they're things you want other people to
    know about. Kind of like a list of favorite PowerShell bookmarks.
    #>
    < #
    Write-Host "Adding Recommendation"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='recommend';
    'url'='https://powershell.org';
    'name'='The PowerShell Community';
    'description'="Community-owned site dedicated to helping IT pro's and developers master PowerShell"}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion —————————————————–

    # —————————————————–
    #region Add Achievements
    # —————————————————–

    < #
    Achievements are badges. You start by getting a list of achievements
    that the system recognizes, and then telling it to add or remove one.

    The "awarded" field is the date you got the achievement (we list
    newest ones first). Use YYYYMMDD as the date format. See a bit
    further down for an example of how to get the achievement list.
    #>
    < #
    Write-Host "Adding achievement"
    $request = @{'verb'='removeachievement';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'awarded'='20120101';
    'name'='powershell_org_board_member'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    #endregion

    #endregion

    # —————————————————–
    #region Get and Remove Item Examples are Listed Below
    # —————————————————–

    #region Get Achievements List

    Write-Host "Listing Achievements"
    $request = @{'verb'='achievements';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    #region Remove Twitter (or LinkedIn, or AboutMe, or Google+, or Facebook, etc)

    Write-Host "Removing bio element"
    $request = @{'verb'='removebio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='twitter'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    #region Remove Links (Same 'type' values as for the 'addlink' verb.)

    Write-Host "Removing Website"
    $request = @{'verb'='removelink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='website';
    'url'='http://mrpowershell.com'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    #endregion

    #endregion

    # —————————————————–
    #region Cleanup Variables
    # —————————————————–
    Clear-Variable uri, credential
    #endregion

    # —————————————————–
    #region Additional Comments by @concentrateddon
    # —————————————————–

    < #
    #>
    #endregion

    by DonJ at 2012-12-13 08:44:14

    No need to paste the whole thing ;). And, if you do, consider using the CODE or POWERSHELL button in the toolbar to format the code. Keeps it a bit more readable.

    I'm not sure why you're passing your network credential as the password. I'd actually recommend against that. I mean, my code hashes the password, but you're transmitting your network password in clear-text. Bear that in mind.

    FullName isn't editable. That's kind of our little IQ test, to see how many people leave it at "Joe Blow."

    I'm not sure what username you used, so I can't pull open the XML file to see what it did. My suggestion is to not pull your network credential. Make up a username and just send in a string for your password and username. If you need me to delete your existing file, I can – I just need the username you picked.

    by DonJ at 2012-12-13 08:50:25

    BTW, there's a newer canonical example script on the /people/ site. It has some additional information that Mike's example lacks. However, Mike's should still work. If you're having trouble with it, ping him on Twitter (https://twitter.com/mikefrobbins) and see if he can give you a hand. You're welcome to point him to this topic, so he can post a reply.

    by mikefrobbins at 2012-12-13 12:12:34

    To change an item, it has to be removed and re-added.

    I copied the following portion of my script that you posted and had no issues removing the website entry and my twitter account:

    $uri = 'https://powershell.org/people/interface.php'
    $credential = Get-Credential -Message "Enter a Username & Password for your PowerShell.org people site account - WARNING: This Password is Transmitted in CLEAR TEXT!"

    Write-Host "Removing bio element"
    $request = @{'verb'='removebio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='twitter'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    Write-Host "Removing Website"
    $request = @{'verb'='removelink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='website';
    'url'='http://mikefrobbins.com/'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    Now I'm re-adding them with this code:

    $uri = 'https://powershell.org/people/interface.php'
    $credential = Get-Credential -Message "Enter a Username & Password for your PowerShell.org people site account - WARNING: This Password is Transmitted in CLEAR TEXT!"

    Write-Host "Adding Website"
    $request = @{'verb'='addlink';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'type'='website';
    'url'='http://mikefrobbins.com/';
    'name'="Mike F Robbins Blog";
    'description'="Mike F Robbins - Computing Solutions Blog"}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    Write-Host "Adding Twitter"
    $request = @{'verb'='addbio';
    'username'= $credential.Username;
    'password'= $credential.GetNetworkCredential().Password;
    'field'='twitter';
    'data'='mikefrobbins'}
    Invoke-WebRequest -URI $uri -Body $request | Select Content | ft -wrap

    I'm going to take a look at the updated script that Don referenced and I'll be updating my script based on the changes.

    by mikefrobbins at 2012-12-13 15:01:08

    Looks like the issue was with editing your full name based on the post in the other forum and not an issue with the script. I've updated my script to reflect the most recent changes: http://gallery.technet.microsoft.com/scriptcenter/powershellorg-people-8ba6701f

    Don, you can blame me for using the Get-Credential cmdlet. See my blog post here: http://wp.me/pDygv-1xj. It works fine in my script since the password is turned into plain text just before it's transmitted. I used it to keep the password a little more secure while it's on the users PC, although it is still transmitted in clear text.

    by msalamon at 2012-12-17 20:13:18

    Thanks guys!–sorry for my stupid!

    ONe more thing-my linedIn URL does not include /in/ – I need to point the URL to http://www.linkedin.com/pub/matt-salamon/17/264/73b –but it looks like /in/ is hard coded – and whatever the user enters in o the data field is appended–any suggestions for folks taht dont have /in/ in their lined profile page?

    by msalamon at 2012-12-17 20:48:23

    whoops-nvrmind-I see that I can edit my LinkedIn URL–sorry again-

You must be logged in to reply to this topic.