<#
setup.ps1

Installs Adobe Lightroom 5

Place installer in .\setup subdirectory.

W7 x86,x64

Adam Sailer
2014.09.21
#>


## Globals
$invoke = split-path -path $myinvocation.mycommand.path -parent
$os = gwmi Win32_OperatingSystem
$proc = gwmi Win32_Processor
$scratch = "$env:TEMP\Scratch"
$whatIf = $false


$serial = @"
regInfo = {
original_serial_number = "",
serial_number = "your serial number here",
uuid = "your generated uuid here",
}
"@


$prefs = @"
prefs = {
Adobe_checkCatalogIntegrityForPaths = "catalogsToCheck = {\
}\
",
AgApplication_HasRegisteredAutoPlay = true,
AgDevelop_hideTargetAdjustmentInfoMomentarily = false,
AgDevelop_leftPanels_inSoloMode = false,
AgDevelop_rightPanels_inSoloMode = false,
AgDevelop_showTargetAdjustmentAmount = 0,
AgDevelop_targetAdjustment = "Exposure2012",
AgDevelop_toneCurve_ShowInfo = true,
AgDocument_defaultModuleID = "com.adobe.ag.library",
AgDocument_moduleHost_firstPanelShowing = true,
AgDocument_moduleHost_lastPanelShowing = true,
AgDocument_moduleHost_lastPanelSize = 122,
AgDrawing_mirrorImageMode = false,
AgEditExternally_putInStack = true,
AgEditExternally_tokens = "{{image_name}}-Edit",
AgEventLoop_slowEventHandling = false,
AgExport_DNG_compatibility = 117506048,
AgExport_DNG_compressed = true,
AgExport_DNG_conversionMethod = "preserveRAW",
AgExport_DNG_embedCache = true,
AgExport_DNG_embedRAW = false,
AgExport_DNG_lossyCompression = false,
AgExport_DNG_previewSize = "medium",
AgExport_collisionHandling = "ask",
AgExport_embeddedMetadataOption = "all",
AgExport_exportServiceProvider = "com.adobe.ag.export.file",
AgExport_export_bitDepth = 16,
AgExport_export_colorSpace = "sRGB",
AgExport_export_destinationPathSuffix = "Untitled Export",
AgExport_export_destinationType = "specificFolder",
AgExport_export_useSubfolder = true,
AgExport_export_videoFileHandling = "include",
AgExport_export_videoFormat = "4e49434b-4832-3634-fbfb-fbfbfbfbfbfb",
AgExport_export_videoPreset = "original",
AgExport_extensionCase = "lowercase",
AgExport_format = "JPEG",
AgExport_includeFaceTagsAsKeywords = true,
AgExport_includeVideoFiles = true,
AgExport_initialSequenceNumber = 1,
AgExport_jpeg_limitSize = 100,
AgExport_jpeg_quality = 0.6,
AgExport_jpeg_useLimitSize = false,
AgExport_metadata_keywordOptions = "flat",
AgExport_minimizeEmbeddedMetadata = false,
AgExport_outputSharpeningLevel = 2,
AgExport_outputSharpeningMedia = "screen",
AgExport_outputSharpeningOn = false,
AgExport_png_interlaced = false,
AgExport_reimportExportedPhoto = false,
AgExport_reimport_stackWithOriginal = true,
AgExport_reimport_stackWithOriginal_position = "below",
AgExport_removeFaceMetadata = true,
AgExport_removeLocationMetadata = true,
AgExport_renamingTokensOn = false,
AgExport_selectedTextFontFamily = "Myriad Web Pro",
AgExport_selectedTextFontSize = 12,
AgExport_size_doConstrain = false,
AgExport_size_doNotEnlarge = false,
AgExport_size_maxHeight = 1000,
AgExport_size_maxWidth = 1000,
AgExport_size_megapixels = 5,
AgExport_size_resizeType = "wh",
AgExport_size_resolution = 240,
AgExport_size_resolutionUnits = "inch",
AgExport_size_units = "pixels",
AgExport_size_userWantsConstrain = false,
AgExport_tiff_compressionMethod = "compressionMethod_None",
AgExport_tiff_preserveTransparency = false,
AgExport_tokenCustomString = "",
AgExport_tokensArchivedToString2 = "{{image_name}}",
AgExport_useWatermark = false,
AgExport_watermarking_id = "<simpleCopyrightWatermark>",
AgIdentityPlates_mainDialog_showDetails = true,
AgImport_destinationPanels_inSoloMode = false,
AgImport_sourcePanels_inSoloMode = false,
AgLibraryDocument_lastSelectedModule = "com.adobe.ag.library",
AgLibrary_QuickDev_color_ExpansionState = 0,
AgLibrary_QuickDev_exposure_ExpansionState = 0,
AgLibrary_QuickDev_general_ExpansionState = 0,
AgLibrary_autoCompleteInKeywordsField = true,
AgLibrary_autoHideInfo1 = false,
AgLibrary_autoHideInfo2 = false,
AgLibrary_browserHeight = 170,
AgLibrary_cellStyle = "compact",
AgLibrary_collectionsPanel_Collapsed = false,
AgLibrary_commentsPanel_Collapsed = true,
AgLibrary_commentsPanel_ExpansionState = 0,
AgLibrary_compareTools20 = "tools = {\
compare = true,\
}\
",
AgLibrary_defaultColumnGenerator_sortDescending_date = false,
AgLibrary_defaultGroupType = "none",
AgLibrary_defaultSortType = "captureTime",
AgLibrary_defaultSpecialPresetItem = "<recent_keywords>",
AgLibrary_developPanel_Collapsed = false,
AgLibrary_faceThumbSize = 120,
AgLibrary_faceTools = "tools = {\
}\
",
AgLibrary_filmstripQuickFilterCollapsed = true,
AgLibrary_filterBarVisible = true,
AgLibrary_folderViewPanel_Collapsed = false,
AgLibrary_gridCondensedText1_v4 = "com.adobe.copynameOrBasename",
AgLibrary_gridCondensedText2 = "com.adobe.ratingAndLabel",
AgLibrary_gridExpandedText1 = "index_number",
AgLibrary_gridExpandedText2_v4 = "com.adobe.copynameOrBasename",
AgLibrary_gridExpandedText3 = "com.adobe.imageCroppedDimensions",
AgLibrary_gridExpandedText4 = "com.adobe.filenameExtension",
AgLibrary_gridFooterHasColorLabels = false,
AgLibrary_gridFooterHasRotation = true,
AgLibrary_gridFooterRotationOnMouseOver = true,
AgLibrary_gridHasFooter = true,
AgLibrary_gridHasHeader = true,
AgLibrary_gridSection1_Expanded = true,
AgLibrary_gridSection2_Expanded = true,
AgLibrary_gridSection3_Expanded = true,
AgLibrary_gridSection4_Expanded = true,
AgLibrary_gridSection5_Expanded = true,
AgLibrary_gridSection6_Expanded = true,
AgLibrary_gridTintOpacity = 0.2,
AgLibrary_gridTools20 = "tools = {\
group = true,\
image_size = true,\
painter = true,\
sort = true,\
}\
",
AgLibrary_histogramPanel_ExpansionState = 1,
AgLibrary_images_target = "selectedPhotos",
AgLibrary_includeChildTags = true,
AgLibrary_infoPanel_Collapsed = true,
AgLibrary_infoPanel_ExpansionState = 0,
AgLibrary_keywordDisplay = "DisplayKeywordTags",
AgLibrary_keywordFilterMode_ExpansionState = 0,
AgLibrary_keywordFilterShowChildren = false,
AgLibrary_keywordsPanel_Collapsed = true,
AgLibrary_keywordsPanel_ExpansionState = 0,
AgLibrary_keywords_shortcut1title = "",
AgLibrary_keywords_shortcut2title = "",
AgLibrary_keywords_shortcut3title = "",
AgLibrary_keywords_shortcut4title = "",
AgLibrary_keywords_shortcut5title = "",
AgLibrary_keywords_shortcut6title = "",
AgLibrary_keywords_shortcut7title = "",
AgLibrary_keywords_shortcut8title = "",
AgLibrary_keywords_shortcut9title = "",
["AgLibrary_lastBackupDate97C2EF99-483D-4A08-94AF-EF693764AFFB"] = 432922146.2048,
AgLibrary_leftPanels_inSoloMode = false,
AgLibrary_libraryPanel_Collapsed = false,
AgLibrary_link2up = true,
AgLibrary_lockFilterState = false,
AgLibrary_loupeInfo1Text1_v4 = "com.adobe.filenameAndCopyname",
AgLibrary_loupeInfo1Text2 = "com.adobe.captureDateTime",
AgLibrary_loupeInfo1Text3 = "com.adobe.imageCroppedDimensions",
AgLibrary_loupeInfo2Text1_v4 = "com.adobe.filenameAndCopyname",
AgLibrary_loupeInfo2Text2 = "com.adobe.exposureAndISO",
AgLibrary_loupeInfo2Text3 = "com.adobe.lensSetting",
AgLibrary_loupeInfoStyle = "info1",
AgLibrary_loupeTools20 = "tools = {\
pick = true,\
rating = true,\
rotate = true,\
}\
",
AgLibrary_loupeZoomInLevel = 1,
AgLibrary_loupeZoomLevel = "fitToView",
AgLibrary_loupeZoomOutLevel = "fitToView",
AgLibrary_metadataDisplaySet = "com.adobe.tagsets.default",
AgLibrary_metadataPanel_Collapsed = true,
AgLibrary_metadataPanel_ExpansionState = 0,
AgLibrary_navigatorPanel_ExpansionState = 1,
AgLibrary_notActive_target = "activePhoto",
AgLibrary_paintingEnabled = false,
AgLibrary_paintingToolWhichType = "keywords",
AgLibrary_paintingTool_developPresetValue = "ED7AD140-FA03-11DB-AB5E-00145166C8C8",
AgLibrary_paintingTool_flagValue = 1,
AgLibrary_paintingTool_labelValue = "",
AgLibrary_paintingTool_ratingEverSet = true,
AgLibrary_paintingTool_ratingValue = 5,
AgLibrary_paintingTool_rotationValue = "cw",
AgLibrary_publishServicesPanel_Collapsed = false,
AgLibrary_rightPanels_inSoloMode = false,
AgLibrary_rootFolderDisplay = "folderNameOnly",
AgLibrary_showAdornmentBadges = true,
AgLibrary_showAdornmentCommandButtons = true,
AgLibrary_showAdornmentIndex = true,
AgLibrary_showAdornmentPickFlag = true,
AgLibrary_showAdornmentQuickCollection = true,
AgLibrary_showAdornmentUnsavedMetadata11 = false,
AgLibrary_showAdornments = true,
AgLibrary_showClickAdornmentsOnMouseOverOnly = true,
AgLibrary_showCompactBottomLabel = true,
AgLibrary_showCompactTopLabel = false,
AgLibrary_showCompareExtras = true,
AgLibrary_showGridTooltips = true,
AgLibrary_showLoupeInfo = false,
AgLibrary_showLoupeRegions = false,
AgLibrary_showLoupeWorkingOverlay = true,
AgLibrary_sortFaces = false,
AgLibrary_sourceSpecificFilters = false,
AgLibrary_surveyTools20 = "tools = {\
label = true,\
navigate = true,\
}\
",
AgLibrary_targetPhotoMetadataOnly = false,
AgLibrary_thumbSize = 120,
AgLibrary_tintGridWithColors = true,
AgLibrary_toolbar_revealedState = "normal",
AgLibrary_volumeBrowserInfo = "capacity",
AgLibrary_volumeBrowserStatusColors = "t = {\
online = AgColor( 0.3, 0.68, 0.3, 1 ),\
}\
",
AgLibrary_volumeBrowserStatusLight = "freeSpace",
AgLibrary_whichView = "images",
AgLocation_leftPanels_inSoloMode = false,
AgLocation_rightPanels_inSoloMode = false,
AgMainFramePlacement_maxPosition_x = -1,
AgMainFramePlacement_maxPosition_y = -1,
AgMainFramePlacement_minPosition_x = -1,
AgMainFramePlacement_minPosition_y = -1,
AgMainFramePlacement_normalPosition_bottom = 840,
AgMainFramePlacement_normalPosition_left = 30,
AgMainFramePlacement_normalPosition_right = 1410,
AgMainFramePlacement_normalPosition_top = 30,
AgMainFramePlacement_showCmd = 3,
AgMainFrame_screenMode = 0,
AgMultiMonitor_autoResize = false,
AgMultiMonitor_blankBackgroundColor = 0,
AgMultiMonitor_browserHeight = 170,
AgMultiMonitor_enablePlopupPreview = false,
AgMultiMonitor_filterBarVisible = true,
AgMultiMonitor_link2up = true,
AgMultiMonitor_loupeMode = "normal",
AgMultiMonitor_overrideSettings = true,
AgMultiMonitor_previewSize = 300,
AgMultiMonitor_previewVisible = false,
AgMultiMonitor_slideshowEnding = false,
AgMultiMonitor_slideshowIntro = false,
AgMultiMonitor_slideshowPauseOnIntro = false,
AgMultiMonitor_slideshowRepeat = false,
AgMultiMonitor_thumbSize = 120,
AgMultiMonitor_visible = false,
AgMultiMonitor_windowFilterBarVisible = false,
AgMultiMonitor_windowVisible = false,
AgNavigator_extraZoomLevel = 3,
AgNavigator_showPhotosOnMouseOver = true,
AgPanel_activeSoloMode = false,
AgPanel_automaticFontSize = true,
AgPanel_baseFontSize = "medium",
AgPanel_defaultSoloMode = false,
AgPrint_leftPanels_inSoloMode = false,
AgPrint_rightPanels_inSoloMode = false,
AgProgressView_visible = false,
AgPublish_DNG_compatibility = 117506048,
AgPublish_DNG_compressed = true,
AgPublish_DNG_conversionMethod = "preserveRAW",
AgPublish_DNG_embedCache = true,
AgPublish_DNG_embedRAW = false,
AgPublish_DNG_lossyCompression = false,
AgPublish_DNG_previewSize = "medium",
AgPublish_collisionHandling = "ask",
AgPublish_embeddedMetadataOption = "all",
AgPublish_exportServiceProvider = "com.adobe.ag.export.file",
AgPublish_export_bitDepth = 16,
AgPublish_export_colorSpace = "sRGB",
AgPublish_export_destinationPathSuffix = "Untitled Export",
AgPublish_export_destinationType = "specificFolder",
AgPublish_export_useSubfolder = true,
AgPublish_export_videoFileHandling = "include",
AgPublish_export_videoFormat = "4e49434b-4832-3634-fbfb-fbfbfbfbfbfb",
AgPublish_export_videoPreset = "original",
AgPublish_extensionCase = "lowercase",
AgPublish_format = "JPEG",
AgPublish_includeFaceTagsAsKeywords = true,
AgPublish_includeVideoFiles = true,
AgPublish_initialSequenceNumber = 1,
AgPublish_jpeg_limitSize = 100,
AgPublish_jpeg_quality = 0.6,
AgPublish_jpeg_useLimitSize = false,
AgPublish_metadata_keywordOptions = "flat",
AgPublish_minimizeEmbeddedMetadata = false,
AgPublish_outputSharpeningLevel = 2,
AgPublish_outputSharpeningMedia = "screen",
AgPublish_outputSharpeningOn = false,
AgPublish_png_interlaced = false,
AgPublish_reimportExportedPhoto = false,
AgPublish_reimport_stackWithOriginal = true,
AgPublish_reimport_stackWithOriginal_position = "below",
AgPublish_removeFaceMetadata = true,
AgPublish_removeLocationMetadata = true,
AgPublish_renamingTokensOn = false,
AgPublish_selectedTextFontFamily = "Myriad Web Pro",
AgPublish_selectedTextFontSize = 12,
AgPublish_size_doConstrain = false,
AgPublish_size_doNotEnlarge = false,
AgPublish_size_maxHeight = 1000,
AgPublish_size_maxWidth = 1000,
AgPublish_size_megapixels = 5,
AgPublish_size_resizeType = "wh",
AgPublish_size_resolution = 240,
AgPublish_size_resolutionUnits = "inch",
AgPublish_size_units = "pixels",
AgPublish_size_userWantsConstrain = false,
AgPublish_tiff_compressionMethod = "compressionMethod_None",
AgPublish_tiff_preserveTransparency = false,
AgPublish_tokenCustomString = "",
AgPublish_tokensArchivedToString2 = "{{image_name}}",
AgPublish_useWatermark = false,
AgPublish_watermarking_id = "<simpleCopyrightWatermark>",
AgSdkPluginLoader_disabledPluginIDs = "t = {\
}\
",
AgSdkPluginLoader_disabledPluginPaths = "t = {\
}\
",
AgSdkPluginLoader_installedPluginPaths = "t = {\
}\
",
AgSlideshow_leftPanels_inSoloMode = false,
AgSlideshow_rightPanels_inSoloMode = false,
AgTemplateBrowserDataModel_copied_ExternalEditor = "s = {\
}\
",
AgTemplateBrowserDataModel_copied_KeywordSet = "s = {\
}\
",
AgTemplateBrowserDataModel_copied_LabelSet = "s = {\
}\
",
AgTemplateBrowserDataModel_copied_LibraryFilter = "s = {\
}\
",
AgTemplateBrowserDataModel_copied_Metadata = "s = {\
}\
",
AgVanityPlates_panelTerminator = "_default",
AgWPG_leftPanels_inSoloMode = false,
AgWPG_rightPanels_inSoloMode = false,
Filmstrip_showAdornments = true,
Filmstrip_showBadges = true,
Filmstrip_showStackCounts = true,
Filmstrip_showTooltips = true,
LayoutBook_leftPanels_inSoloMode = false,
LayoutBook_rightPanels_inSoloMode = false,
LayoutSlideshow_leftPanels_inSoloMode = false,
LayoutSlideshow_rightPanels_inSoloMode = false,
LibraryPanels_firstPanelShowing = true,
LibraryPanels_firstPanelSize = 263,
LibraryPanels_lastPanelShowing = true,
LibraryPanels_lastPanelSize = 263,
Lightroom_userIdentityPlateEnabled = false,
Lightroom_userIdentityPlateMode = "sync_user",
LocationModule_daily_geocode_requests = 0,
LocationModule_mapLatitude = 16,
LocationModule_mapLongitude = 0,
LocationModule_mapMode = "google.maps.MapTypeId.HYBRID",
LocationModule_mapZoom = 2,
LocationModule_showFilterBar = true,
Location_cityFieldEnabled = true,
Location_countryFieldEnabled = true,
Location_gpsFieldEnabled = true,
Location_stateFieldEnabled = true,
Location_sublocationFieldEnabled = true,
MultiMonitorPanels_syncPanels = true,
RegistrationField_CountryRegion = "1",
Showed_Sync_Walkthrough = true,
VersionManagerCheckDate = 432922137.7808,
collectionPanelSortOrder = "kind",
["com.adobe.ag.library_Showed_Walkthroughs"] = true,
externalEditingFormat = "TIFF_LZW_8_sRGB",
firstLaunchHasRun30 = true,
label1 = "Red",
label2 = "Yellow",
label3 = "Green",
label4 = "Blue",
label5 = "Purple",
libraryToLoad20 = "",
onePixelFudge = true,
photoBinSize = 150,
photoshopEditingFormat = "TIFF_ZIP_16_ProPhotoRGB",
recentLibraries20 = "",
recentLibraries20_missing = "recentMissingLibraries = {\
}\
",
recentLibraryBehavior20 = "UseMostRecentLibrary",
runLightroomInBaseMode = true,
["sdk_com.adobe.lightroom.export.facebook"] = "prefs = {\
KillSwitchResponse = {\
localOSTime = 1411229340,\
locale = \"en_us\",\
plugin_version = \"5.6.0.974614\",\
status = \"ok\",\
timestamp = \"2014-09-20T16:05:55+00:00\",\
},\
}\
",
["sdk_com.adobe.lightroom.export.flickr"] = "prefs = {\
KillSwitchResponse = {\
localOSTime = 1411229341,\
locale = \"en_us\",\
plugin_version = \"5.6.0.974614\",\
status = \"ok\",\
timestamp = \"2014-09-20T16:05:55+00:00\",\
},\
}\
",
showPublishServiceIcons = true,
}
"@



Function KillApps
{
write-host "`n`n@@ Called KillApps" -fore Magenta
get-process -name lightroo* | stop-process -force
}


Function Uninstall
{
Param([string]$inp)

write-host "`n`n@@ Called Uninstall" -fore Magenta

if (!$inp) { Return }

$paths = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
) | ? { test-path $_ }

(dir $paths | % { gp $_.PsPath } | ? { $_.DisplayName -imatch $inp }) | % { $item = $_

if ($whatIf) { write $item }

$item.UninstallString | % {

$app = $_; $options = '/S'

if ($_ -imatch 'msiexec') {
$array = $_.Split(' {}')
$app = $array[0]; $options = "/qn /x {$($array[2])}"
}

write-host "Uninstalling : $($item.DisplayName) $($item.DisplayVersion)"

if (!$whatIf) {
$process = (Start-Process -FilePath $app -ArgumentList $options -Wait -Passthru)
$process.ExitCode | ? { $_ -ne 0 } | % { write $_; exit $_ }
}
}
}
}


Function Unpack
{
write-host "`n`n@@ Called Unpack" -fore Magenta

$7z = get-item "$env:ProgramFiles\7-Zip\7z.exe" -ea SilentlyContinue
if (!$7z) { exit 7 }

(dir -path $invoke\setup -recurse -include Lightroom*.exe) | % { $archive = $_

write-host "Unpack : $($archive.Name)"
$options = "x -o`"$scratch\$($archive.BaseName)`" `"$archive`" -y"

if (!$whatIf)
{
remove-item $scratch -recurse -force -ea SilentlyContinue

$process = (Start-Process -FilePath $7z -ArgumentList $options -Wait -Passthru)
if ($process.ExitCode) { write-host $process.ExitCode; exit $process.ExitCode }
}
else { write-host $options }
}
}


Function Setup
{
write-host "`n`n@@ Called Setup" -fore Magenta

$ident = 'setup32.exe'
if (($proc.AddressWidth -eq 64) -and ($proc.DataWidth -eq 64))
{ $ident = 'setup64.exe' }

(dir -recurse $scratch -include $ident) | % { $app = $_

write-host "Setup : $($app.Name)"
$options = "/S /v/qn"

if (!$whatIf)
{
$process = (Start-Process -FilePath $app -ArgumentList $options -Wait -Passthru)
remove-item $scratch -recurse -force -ea SilentlyContinue
$process.ExitCode | ? { $_ -ne 0 } | % { write $_; exit $_ }
}
}
}


Function License
{
write-host "`n`n@@ Called License" -fore Magenta

dir $env:ProgramData,"$env:SystemDrive\Users" -recurse -force -include lightr*.lrreg,lightr*.agprefs -ea SilentlyContinue | % { $_ | remove-item -force }

## The following files need to be present in every user profile, including Default:
## <UserProfile>\AppData\Roaming\Adobe\Lightroom\Lightroom 5.0 Registration.lrreg"
## <UserProfile>\AppData\Roaming\Adobe\Lightroom\Preferences\Lightroom 5 Preferences.agprefs

$paths = @(gwmi win32_UserProfile | ? { $_.Special -eq $false } | % { $_.LocalPath })
$paths += "$env:SystemDrive\Users\Default"
$paths += $env:Public

$paths | sort-object | % { $path = $_

write-host $path

new-item "$path\AppData\Roaming\Adobe" -ItemType Directory -ea SilentlyContinue
new-item "$path\AppData\Roaming\Adobe\Lightroom" -ItemType Directory -ea SilentlyContinue
new-item "$path\AppData\Roaming\Adobe\Lightroom\Preferences" -ItemType Directory -ea SilentlyContinue

## Encoding must be UTF8 w/o BOM:
$paths | % { [System.IO.File]::WriteAllLines("$_\AppData\Roaming\Adobe\Lightroom\Lightroom 5.0 Registration.lrreg", $serial) }
$paths | % { [System.IO.File]::WriteAllLines("$_\AppData\Roaming\Adobe\Lightroom\Preferences\Lightroom 5 Preferences.agprefs", $prefs) }
}

## dir $env:ProgramData,"$env:SystemDrive\Users" -recurse -force -include lightr*.lrreg,lightr*.agprefs -ea SilentlyContinue | % { $_.FullName }
}


Function CleanDesktop
{
write-host "`n`n@@ Called CleanDesktop" -fore Magenta

$paths = @(
"$env:allUsersProfile\Desktop",
"$env:public\Desktop"
) | where-object { $_ }

(dir -path $paths -force -recurse -include lightroom*.lnk -ea SilentlyContinue) | % {

write-host "Delete : $($_.FullName)"
remove-item -path $_ -force -ea SilentlyContinue -whatIf:$whatIf
}
}


#
#


Clear
KillApps
Uninstall 'Adobe Photoshop Lightroom'
Unpack
Setup
License
CleanDesktop


<#
First Run:
C:\ProgramData\Adobe\Lightroom\Lightroom 5.0 Registration.lrreg
C:\Users\All Users\Adobe\Lightroom\Lightroom 5.0 Registration.lrreg
These paths resolve to the same file

uuid does not seem to matter


The following files need to be present in every user profile, including Default:
<UserProfile>\AppData\Roaming\Adobe\Lightroom\Lightroom 5.0 Registration.lrreg"
<UserProfile>\AppData\Roaming\Adobe\Lightroom\Preferences\Lightroom 5 Preferences.agprefs

Install once and register to get valid .lrreg and .agprefs files; Remove
references to specific user profile libraries.

Encoding must be UTF8 w/o BOM:
http://en.wikipedia.org/wiki/Byte_order_mark
#>