Categories: SCCM, System Center, UncategorizedHey CheckYourLogs fans! While working on a recent engagement, we wanted to populate a 1E Shopping site with a rather lengthy list of icons for client-facing applications. The admin had already painstakingly added all the icons into Software Center, but we couldn’t find a method to pull them out en masse. We found a […](Read more...)
Hey CheckYourLogs fans!
While working on a recent engagement, we wanted to populate a 1E Shopping site with a rather lengthy list of icons for client-facing applications. The admin had already painstakingly added all the icons into Software Center, but we couldn’t find a method to pull them out en masse. We found a script on https://www.sqlshack.com that could be used to extract icons from a SQL database, and my client made a few tweaks to make it work with Configuration Manager. Thanks for letting me share it, Mike!
## https://www.sqlshack.com/export-sql-server-filestream-objects-with-powershell-and-ssis/
$Server = "SCCM.SERVER.FQDN";
$Database = "cm_ps1";
$Dest = "C:\Drivers\Icons\";
$bufferSize = 8192;
$Sql = "SELECT
Distinct([Icon]), [Title]
FROM [CM_QD1].[dbo].[CI_LocalizedCIClientProperties]
where icon is not null
";
$con = New-Object Data.SqlClient.SqlConnection;
$con.ConnectionString = "Data Source=$Server;" +
"Integrated Security=True;" +
"Initial Catalog=$Database";
$con.Open();
Write-Output ((Get-Date -format yyyy-MM-dd-HH:mm:ss) + ": Export ICON objects Started ...");
$cmd = New-Object Data.SqlClient.SqlCommand $Sql, $con;
$rd = $cmd.ExecuteReader();
$out = [array]::CreateInstance('Byte', $bufferSize)
While ($rd.Read())
{
try
{
Write-Output ("Exporting Objects from FILESTREAM container: {0}" -f $rd.GetString(1));
# New BinaryWriter
$fs = New-Object System.IO.FileStream ($Dest + $rd.GetString(1) + ".png"), Create, Write;
$bw = New-Object System.IO.BinaryWriter $fs;
$start = 0;
# Read first byte stream
$received = $rd.GetBytes(0, $start, $out, 0, $bufferSize - 1);
While ($received -gt 0)
{
$bw.Write($out, 0, $received);
$bw.Flush();
$start += $received;
# Read next byte stream
$received = $rd.GetBytes(0, $start, $out, 0, $bufferSize - 1);
}
$bw.Close();
$fs.Close();
}
catch
{
Write-Output ($_.Exception.Message)
}
finally
{
$fs.Dispose();
}
}
$rd.Close();
$cmd.Dispose();
$con.Close();
Write-Output ("Finished");
Read-Host -Prompt "Press Enter to exit"
Hope this helps!
É
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Server AntiVirus Exclusions in Configuration Manager | 0 | 12.6 | 19-10-2019 |
| 2 | Top Level Configuration Manager Collections | 0 | 11.32 | 21-03-2018 |
| 3 | Windows Server Patching Without Configuration Manager | 0 | 12.11 | 26-02-2024 |
| 4 | Windows 10 Servicing Plans – Running out of Space – Filtering Updates – Too many Languages #SCCM #ServcingPlans | 0 | 9.99 | 01-06-2018 |
| 5 | Free Workshop: Introducing Winget | 0 | 10.25 | 04-01-2024 |
| 6 | Video: Introducing Windows Autopatch – A Leap Towards Automated Security | 0 | 7.67 | 13-02-2024 |
| 7 | The Case of not being able to Migrate between Hyper-V Clusters using SCVMM – #HyperV #SCVMM | 0 | 10.96 | 04-10-2018 |
| 8 | How to Install Solarwinds Orion Platform | 0 | 10.63 | 23-12-2021 |
| 9 | How to Upgrade Veeam Backup and Replication to v12.3.0.310 | 0 | 15.31 | 05-12-2024 |
| 10 | From Logs to Insights: My First SIEM Deployment with Wazuh | 0 | 5.93 | 29-07-2026 |