http://www.gamespot.com/pc/strategy/civilizationv/index.html
Author Archive
| To install the Administration Tools pack by using the Windows interface |
- Download the Administration Tools package from the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkID=137379).
- Open the folder into which the package downloaded, double-click the package to unpack the files, and then start the Remote Server Administration Tools Setup Wizard.

Note You must accept the License Terms and Limited Warranty to install Administration Tools. - Complete all the steps that are required by the wizard, and then click Finish to exit the wizard when installation is completed.
- Click Start, click Control Panel, and then click Programs.
- In the Programs and Features area, click Turn Windows features on or off.
If you are prompted by User Account Control to allow the Windows Features dialog box to open, click Continue.
- In the Windows Features dialog box, expand Remote Server Administration Tools.
- Select the remote management tools that you want to install, and then click OK.
- Configure the Start menu to display the Administration Tools shortcut, if it is not already there.
- Right-click Start, and then click Properties.
- On the Start Menu tab, click Customize.
- In the Customize Start Menu dialog box, scroll down to System Administrative Tools, and then select Display on the All Programs menu and the Start menu. Click OK.
Shortcuts for snap-ins installed by Remote Server Administration Tools for Windows 7 are added to the Administrative Tools list on the Start menu.
1 2 | $notespw = Read-Host "Enter the password for the Notes ID file" -AsSecureString $notespw | ConvertFrom-SecureString | Set-Content $pwfile -force |
To retrieve the password and create the PSCredential object:
1 2 | $notespw = get-content $pwfile | ConvertTo-SecureString $notesid = new-object -typename system.management.automation.pscredential -argumentlist "-default-",$notespw |
Example of use:
1 | Get-DominoMailbox mary@contoso.com -SourceCredential $notesid |
You will used this for help in setting up and using the api tools for windows. P.S. in no particular order.
http://docs.amazonwebservices.com/AWSEC2/2007-08-29/GettingStartedGuide/setting-up-your-tools.html
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1767
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351
http://serktools.com/2009/05/19/setting-up-ec2-command-line-tools-on-windows/
If you are like me and are just so used to typing set to list and set environment variables then you might find this script useful.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | if (test-path alias:set) { remove-item alias:set > $null } function set { [string]$var = $args if ($var -eq "") { get-childitem env: | sort-object name } else { if ($var -match "^(\S*?)\s*=\s*(.*)$") { set-item -force -path "env:$($matches[1])" -value $matches[2]; } else { write-error "ERROR Usage: VAR=VALUE" } } } |
This has been out for a while now. I really hadn’t needed to use this, however I used it a handful of times this week, and i do love it!!
http://blogs.msdn.com/webplatform/
http://www.microsoft.com/Web/
This is an example of a very simple multi thread script. All it does is output 2 user names per function.
But you can only imagine the power.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | #Create a function, or in this example create/split up a large job into multiple functions. #Step 1 : Create threading.ps1 #Step 2 : Create function and add it to threading.ps1 #(Sample Function) function one{ $users1 = "CORP1\Bollasr1", "CORP2\aardeje1" foreach ($u in $users1){ Write-Output "$u" } } one | out-File C:\lnl\oneresults.txt #Step 3 : Wrap the function inside a function with (Write-Output ' ') around each line. #(Sample Wrapped Function) function createone{ Write-Output 'function one{' Write-Output ' $users1 = "CORP1\Bollasr1", "CORP2\aardeje1"' Write-Output ' foreach ($u in $users1){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'one | out-File C:\lnl\oneresults.txt' } #Now I will show an example of 5 threads. This file is called threading.ps1 ##Create Multi Thread Script function createone{ Write-Output 'function one{' Write-Output ' $users1 = "CORP1\Bollasr1", "CORP2\aardeje1"' Write-Output ' foreach ($u in $users1){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'one | out-File C:\lnl\oneresults.txt' } function createtwo{ Write-Output 'function two{' Write-Output ' $users2 = "CORP1\dudlesu1", "CORP2\duerrma1"' Write-Output ' foreach ($u in $users2){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'two | out-File C:\lnl\tworesults.txt' } function createthree{ Write-Output 'function three{' Write-Output ' $users3 = "CORP1\khattpa2", "CORP1\khattsa1"' Write-Output ' foreach ($u in $users3){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'three | out-File C:\lnl\threeresults.txt' } function createfour{ Write-Output 'function four{' Write-Output ' $users4 = "CORP1\pellath1", "CORP2\pellian5"' Write-Output ' foreach ($u in $users4){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'four | out-File C:\lnl\fourresults.txt' } function createfive{ Write-Output 'function five{' Write-Output ' $users5 = "CORP1\trancu1", "CORP2\tranth8"' Write-Output ' foreach ($u in $users5){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'five | out-File C:\lnl\fiveresults.txt' } #Step 4 : Create .ps1 scripts out of the functions. #Take note that ..\..\ alows for a releative path. createone | out-File ..\..\Threadone.ps1 createtwo | out-File ..\..\Threadtwo.ps1 createthree | out-File ..\..\Threadthree.ps1 createfour | out-File ..\..\Threadfour.ps1 createfive | out-File ..\..\Threadfive.ps1 #Step 5 : Launch threading script. start-job -filepath ..\..\Threadone.ps1 start-job -filepath ..\..\Threadtwo.ps1 start-job -filepath ..\..\Threadthree.ps1 start-job -filepath ..\..\Threadfour.ps1 start-job -filepath ..\..\Threadfive.ps1 #Step 6 : Check Status of Jobs #The Wait-Job cmdlet waits for Windows PowerShell background jobs to complete before it displays the command prompt. get-job | wait-job #Step 7 : Stop any Job that may be hung. #The Stop-Job cmdlet stops Windows PowerShell background jobs that are in progress. get-job | stop-job #full Script called threading.ps1 ##Create Multi Thread Script function createone{ Write-Output 'function one{' Write-Output ' $users1 = "CORP1\Bollasr1", "CORP2\aardeje1"' Write-Output ' foreach ($u in $users1){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'one | out-File C:\lnl\oneresults.txt' } function createtwo{ Write-Output 'function two{' Write-Output ' $users2 = "CORP1\dudlesu1", "CORP2\duerrma1"' Write-Output ' foreach ($u in $users2){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'two | out-File C:\lnl\tworesults.txt' } function createthree{ Write-Output 'function three{' Write-Output ' $users3 = "CORP1\khattpa2", "CORP1\khattsa1"' Write-Output ' foreach ($u in $users3){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'three | out-File C:\lnl\threeresults.txt' } function createfour{ Write-Output 'function four{' Write-Output ' $users4 = "CORP1\pellath1", "CORP2\pellian5"' Write-Output ' foreach ($u in $users4){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'four | out-File C:\lnl\fourresults.txt' } function createfive{ Write-Output 'function five{' Write-Output ' $users5 = "CORP1\trancu1", "CORP2\tranth8"' Write-Output ' foreach ($u in $users5){' Write-Output ' Write-Output "$u"' Write-Output ' }' Write-Output '}' Write-Output 'five | out-File C:\lnl\fiveresults.txt' } createone | out-File ..\..\Threadone.ps1 createtwo | out-File ..\..\Threadtwo.ps1 createthree | out-File ..\..\Threadthree.ps1 createfour | out-File ..\..\Threadfour.ps1 createfive | out-File ..\..\Threadfive.ps1 start-job -filepath ..\..\Threadone.ps1 start-job -filepath ..\..\Threadtwo.ps1 start-job -filepath ..\..\Threadthree.ps1 start-job -filepath ..\..\Threadfour.ps1 start-job -filepath ..\..\Threadfive.ps1 get-job | wait-job get-job | stop-job |
The below links were used to create this script. Thanks
http://blogs.msdn.com/powershell/archive/2009/01/10/capture-console-screen.aspx
http://www.sharepointdevwiki.com/display/public/Updating+User+Profiles+in+SharePoint+SSP+using+PowerShell
http://blogs.flexnetconsult.co.uk/colinbyrne/PermaLink,guid,a332015d-c5dc-4433-a0f3-247fd37b0b04.aspx
Download the file here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | [void][reflection.assembly]::Loadwithpartialname("Microsoft.SharePoint") | out-null [void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server.Search") | out-null [void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server") | out-null ################################################################################################################# # Get-ConsoleAsText.ps1 # Thanks to http://blogs.msdn.com/powershell/archive/2009/01/10/capture-console-screen.aspx for Get-ConsoleAsText.ps1 # The script captures console screen buffer up to the current cursor position and returns it in plain text format. # # Returns: ASCII-encoded string. # # Example: # # $textFileName = "$env:temp\ConsoleBuffer.txt" # .\Get-ConsoleAsText | out-file $textFileName -encoding ascii # $null = [System.Diagnostics.Process]::Start("$textFileName") ################################################################################################################# function Get-ConsoleAsText{ # Check the host name and exit if the host is not the Windows PowerShell console host. if ($host.Name -ne 'ConsoleHost') { write-host -ForegroundColor Red "This script runs only in the console host. You cannot run this script in $($host.Name)." exit -1 } # Initialize string builder. $textBuilder = new-object system.text.stringbuilder # Grab the console screen buffer contents using the Host console API. $bufferWidth = $host.ui.rawui.BufferSize.Width $bufferHeight = $host.ui.rawui.CursorPosition.Y $rec = new-object System.Management.Automation.Host.Rectangle 0,0,($bufferWidth - 1),$bufferHeight $buffer = $host.ui.rawui.GetBufferContents($rec) # Iterate through the lines in the console buffer. for($i = 0; $i -lt $bufferHeight; $i++) { for($j = 0; $j -lt $bufferWidth; $j++) { $cell = $buffer[$i,$j] $null = $textBuilder.Append($cell.Character) } $null = $textBuilder.Append("`r`n") } return $textBuilder.ToString() } ################################################################ # Pause Script function Pause ($Message="Script Complete. Press any key to continue...") { Write-Host -NoNewLine $Message $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Write-Host "" } ################################################################ function Get-UserProfileConfigManager([string]$siteUrl) { # Need to get a PortalContext object # as we do not have a HttpContext we need to source one the hard way $site=new-object Microsoft.SharePoint.SPSite($siteUrl) $servercontext=[Microsoft.Office.Server.ServerContext]::GetContext($site) $site.Dispose() # clean up ################################################################ # Return the UserProfileConfigManager new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext) } function Get-SPProfileManager([string]$siteUrl) { # Need to get a PortalContext object # as we do not have a HttpContext we need to source one the hard way $site=new-object Microsoft.SharePoint.SPSite($siteUrl) $servercontext=[Microsoft.Office.Server.ServerContext]::GetContext($site) $site.Dispose() # clean up ################################################################ # Return the UserProfileManager new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($servercontext) } function Get-SPUserProfile([string]$siteUrl, [string] $u) { $upm= Get-SPProfileManager([string]$siteUrl) if ($upm.UserExists($u) -eq $false) { $upm.CreateUserProfile($u) $upm.GetUserProfile($u) } ################################################################ # Create function function Update-UserProfileProperty() { PARAM ( [string] $siteUrl = $( throw "You must provide a Site Collection Url e.g. 'http://moss/'"), [string] $userName = $( throw "You must provide a User Name e.g. 'DOMAIN\USERNAME'"), [string] $propName = $( throw "You must provide a User Profile Property Name e.g. 'WorkPhone'"), [string] $propValue = $( throw "You must provide a User Profile Property Value e.g. '0400 767 022'") ) END { if ($propValue -eq "NULL" -or $propValue -eq "" -or $propValue -eq "None") { Write-Host "Property '$propName' is not set ('$propValue')" } else { $cm = get-userprofileconfigmanager $siteUrl $spm = Get-SPProfileManager $siteUrl if ($spm.UserExists($userName)) { $userProfile = $spm.GetUserProfile($userName); $tempProp = $spm.Properties.GetPropertyByName($propName); if ($tempProp -eq $null) { throw "User Profile Property '$propName' does not exist!"; } else { $userProfile[$propName].Value = $propValue; $userProfile.Commit(); } write-host -foregroundcolor green "'$propName' User Profile Property updated to '$propValue' for '$userName'" Write-Output "'$propName' User Profile Property updated to '$propValue' for '$userName'" } else { Write-Host -ForegroundColor red "User '$userName' does not exist in User Profiles!" Write-output "User '$userName' does not exist in User Profiles!"; } } } } ################################################################ function MySiteProUpdate{ $username = "IB\Admin", "IB\Guest", "IB\PowerShell" # Set MySite URL $siteUrl = "http://mysites:3000" # Notifies Write-Host "Working... Please Wait" Write-Output " " foreach($u in $username){ # Executes command for all users in this script Write-Output "Executing this command : Update-UserProfileProperty $siteUrl $u ActiveEmployee true" Update-UserProfileProperty $siteUrl "$u" "ActiveEmployee" "true" } # Dump Console $textFileName = "C:\IBLogs\ConsoleDump.txt" Get-ConsoleAsText | out-file $textFileName -encoding ascii #$null = [System.Diagnostics.Process]::Start("$textFileName") pause } ################################################################ MySiteProUpdate | out-File C:\IBLogs\Progress.txt |






