Tag: add

SVN Basic

subversionA colleague made a pretty cool blog post about svn basic on his blog. Subverion is a software versioning and a revision control system. At work all our program code and scripts, every little piece of code is going in your Subversion repository. This allows you to get back to earlier revisions of the code or simply share and work on code with other employees. Even your documentation is going into the Subversion repository.

On his blog post (German) he shows the basics of subversion, doing a checkout of e repository, adding files, changing files, removing files and more.

Here is a basic list of svn commands, if you need more information you should check the Subversion Homepage or try the Blog post from tspycher.com

[bash]
svn checkout http://svn.colab.company.com # SVN checkout
svn commit -m “My Message and Changes” # SVN committing changes and new files
svn add /files/*.* # Adding Files to the SVN Repository after this you have to commit that
svn update # Update your local copy
[/bash]

A lot of IDE’s (Integrated Development Environment) like Visual Studio or Xcode have SVN integrated.



iOS 4.1 beta 2 calendar invites

iOS 4.1 beta 2 with calendar invites

Apple just released iOS 4.1 beta 2. After some testing I found something I was looking for in every release. In iOS 4.1 beta 2 you can now send calendar invites to other people by creating a new event.



Powershell: Working with XML part 2

Powershell Header

After my first post (Powershell: Parsing XML part 1) about working with XML and Powershell, I have create this second post which describes how to create a XML file, Add content to the XML file, remove content from the XML file and save the XML objects as a file.

While I was writing a script which communicates with a webserver, I realized that I need some error handling if the server can not anwser a request from my script. For example if the webserver is down or has to much load.

I created a little retry part (Powershell: Simple retry logic) which retries several times. But if the Server is down for several hours or days your script hangs in a retry loop. Obviously this cant be the solution. After a little bit of thinking a decided to write the data, which I was trying to send, down in a XML file. And the next time the script runs it reads the XML file and tries to send the data again.

Thats the story behind my idea for saving data in a XML file.

Creating a XML object

[powershell]
[XML]$FruitList = “<Box>
<Fruit>
<Name>Banana</Name>
<Color>yellow</Color>
</Fruit>
</Box>”
[/powershell]

Save a XML object as a XML file

[powershell]
$FruitList.Save(“./myfruitlist.xml”)
[/powershell]
XML:
[XML]


Banana
yellow


[/XML]

Open a saved XML file

[powershell]
[xml]$FruitList = Get-Content ./myfruitlist.xml
[/powershell]

Add data to XML object and save it in a XML file

[powershell]
# Copy Object from Banana
[Object]$CopyFruit = FruitList.Box.Fruit | Where-Object {$_.Name -eq “Banana”}
$NewFruit = $CopyFruit.Clone()
# Add Fruit to new Object
$NewFruit.Name = “Apple”
$NewFruit.Color = “green”
# Add Fruit to XML Object
$FruitList.Box.AppendChild($NewFruit)
#Save to XML object ot XML file
$FruitList.Save(“./myfruitlist.xml”)
[/powershell]
XML:
[XML]


Banana
yellow


Apple
green

[/XML]

Change data from XML Object and save it as XML file

[powershell]
# Change Apple Color
$FruitList.Box.Fruit | Where-Object {$_.Name -eq “Apple”} | ForEach-Object { $_.Color = “red” }
#Save to XML object ot XML file
$FruitList.Save(“./myfruitlist.xml”)
[/powershell]
XML:
[XML]


Banana
yellow


Apple
red

[/XML]

Remove data from XML Object and save it as XML file

[powershell]
# Remove Banana from Object
$RemoveFruit = $FruitList.Box.Fruit | Where-Object {$_.Name -eq “Banana”}
$FruitList.Box.RemoveChild($RemoveFruit)
#Save to XML object ot XML file
$FruitList.Save(“./myfruitlist.xml”)
[/powershell]
XML:
[XML]


Apple
green

[/XML]


Cheatsheet: Add roles and features to a Server Core installation #2

This are some commands to add roles and features to a Windows Server 2008 R2 Core installation.

You also can enable Remote MMC and Remote Server Manager to simply connect from a management server to the core server and add roles with GUI. This may only work within a domain environment. You can enable remote management pretty easy with the sconfig.cmd. Find out more about configuring Windows Server 2008 R2 Core installations here.

List available server roles and features:

oclist

Install, uninstall and configure Active Directory Domain Service role:

dcpromo

Help for dcpromo:

PS C:\> dcpromo /?

Command line parameters include:

/unattend[:filename]
Used to specify the unattend operation mode or supply an unattended install script file.

/adv
Enables advanced user options.

/uninstallBinaries
Used to uninstall Active Directory Domain Services binaries.

/?[:{Promotion | CreateDcAccount | UseExistingAccount | Demotion}]

/?:Promotion, /?:CreateDCAccount, /?:UseExistingAccount, and /?:Demotion
will display unattend parameters applicable to the specified task. /CreateDCAccount and /UseExistingAccount:Attach are mutually exclusive.

/CreateDCAccount
Creates an RODC account.

/UseExistingAccount:Attach
Attaches the server to an RODC account.

/forceRemoval
Forcefully uninstalls Active Directory Domain Services on this domain controller. The account for the domain controller will not be deleted in the directory, and changes that have occurred on this domain controller since it last replicated with a partner will be lost.

/?
Will display this help.

Unattend parameters can also be specified on the command-line. For example:

dcpromo.exe /ReplicaOrNewDomain:Replica

Press any key to quit ...

Install a role or feature its basically always the same:

start /w ocsetup <roleorfeature>

start /w ocsetup DNS-Server-Core-Role

Uninstall a role or feature:

start /w ocsetup <roleorfeature> /uninstall

start /w ocsetup DNS-Server-Core-Role /uninstall

Install SNMP feature:

start /w ocsetup SNMP-SC

Install Microsoft Hyper-v role:

start /w ocsetup Microsoft-Hyper-V