# Get filename in ConfigMgr 2012 ContentLib

In ConfigMgr 2007 it was kind of convinient to be able to edit files directly on a DP, in ConfigMgr 2012 that isn’t to easy if you are using Content Library.

There are a few ways to find out where the files are actually stored, here is one way:

(Will give you the path to somefile.xml in package ABC01234)

PARAM (
$siteCode = "ABC",$FileName = "somefile.xml",
$PackageID = "ABC01234",$ContentLib = "D:\SCCMContentLib"
)
Import-Module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1')
Set-Location "$($siteCode):"

$package = Get-CMPackage -ID$PackageID
$hash = (Get-Content "$($ContentLib)\DataLib\$($package.PackageID).$($package.StoredPkgVersion)\$($FileName).INI" | Where-Object {$_ -like "Hash=*" }).Replace("Hash=", "")
$storePath = Join-Path "$($ContentLib)\FileLib" "$($hash.Substring(0,4))\$($hash)"$sourcePath = Join-Path $package.PkgSourcePath$FileName

Write-Host "Source: $($sourcePath)"
Write-Host "Store : $($storePath)"


Will result in something like this:

Source: \\server\share\path\to\package source\somefile.xml
Store : D:\SCCMContentLib\FileLib\A123\A1234567890ABCDEF1234567890ABCDEF


And with this you can edit the XML-file directly on the store instead of editing source, update DPs, wait for processing, wait some more…

… but, I’m not saying that I recommend anyone to edit files directly in the store. 😉

Comments are closed.