Latest Posts

Deploy a new version of Windows Update Agent WUA

When using software Updates with Configuration Manager you may   want to deploy a new WU Agent to your machines for several reasons. WUA might cause all kinds of problems with client scanning and deployment. So my recommendation is to keep the WU Agent up to date. It’s not all times the clients update the agent by itself so therefore you will see a manual way of deploying it in this article.

After that you need to create a package with the source files and distribute it to your DPs. We also need to specify a program for the package I use this syntax for my x86 platform as I don’t want to force a restart and also hide it from the end user.

WindowsUpdateAgent30-x86.exe /WUForce /quiet /norestart
  • We will also need to create a collection for your machines to target an example query could be the following. With this query all active non obsolete clients that doesn’t have WUA 7.4.7600.226 will be listed. Make sure you have not like or like otherwise the version handling won’t work.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_WINDOWSUPDATEAGENTVERSION on SMS_G_System_WINDOWSUPDATEAGENTVERSION.ResourceID = SMS_R_System.ResourceId where SMS_G_System_WINDOWSUPDATEAGENTVERSION.Version not like "7.4.7600.226" and SMS_R_System.Client = 1 and SMS_R_System.Obsolete != 1 and SMS_R_System.Active = 1

 

  • After this you need to create an advertisement to deploy to the collection and follow your deployment in the reports.

Setting cache size on clients with script

Do you want to change the SMS/SCCM client cache size setting in your environment you can do this with a script. I will show you 2 examples of doing it.

On Error Resume Next
 Set oUIResource = CreateObject("UIResource.UIResourceMgr")
Set objCacheInfo = oUIResource.GetCacheInfo
 nValueToSet = 20480
 objCacheInfo.TotalSize = nValueToSet

If you would like to deploy it via SMS/SCCM with different sizes you can use the script below. Save it as a ex. setclientcachesize.vbs script and create a folder in our package area and create different programs for it.

  • setclientcachesize.vbs 10240
  • setclientcachesize.vbs 15360
  • setclientcachesize.vbs 20480

If you would like to set your client cache size to a static value a script like this would to it. Save the code and save it as a .vbs script, and deploy in preferred way. To change the size change the value 20480 to preferred value in MB.

On Error Resume Next
 Set oUIResource = CreateObject("UIResource.UIResourceMgr")
Set objCacheInfo = oUIResource.GetCacheInfo
 nValueToSet = wscript.arguments(0)
 objCacheInfo.TotalSize = nValueToSet

 

Delete files older then x days

When I configure System Center Configuration Manager I always setup a cleanup job to delete certain files that will fill up the disks. An example is the IIS log files that potentially will grow allot. So first I move them off the default location on the C drive to another content drive, and then I configure a scheduled task to run a script that removes older files. I usually keep 7 days of logs for troubleshooting purposes.

Below you have a sample script to delete files older then 7 days. It can easily be changed for your own preferences.

'This is a script to delete files older then specified days
Option Explicit

Dim oFSO
Dim sDirectoryPath
Dim oFolder
Dim oFileCollection
Dim oFile
Dim iDaysOld
'iDaysold = Delete files older then x amount of days
iDaysOld = 7

'sDirectoryPath = "Folder to deleteFiles in"
sDirectoryPath = "C:Tempforanexample"

On Error Resume Next

Set oFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(sDirectoryPath) Then
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files

For each oFile in oFileCollection
If oFile.DateLastModified < (Date() - iDaysOld) Then
oFile.Delete(True)
End If
Next
else
WScript.Echo "No Folder"
End If

Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing

 

 

MSFAQ.SE

MSFAQ

Hi, as many of you noticed my blog was down for a long period in the beginning of 2013, this was due to issues with my provider having issues with DDOS attacks wich keep my site offline and unresponsive , I have blogged on MSFAQ.SE since 2006 so its a bit sad but I also felt I wanted something new and fresh so I started this new blog instead where you can follow the trails I set in the world of System Management.

So stay tuned here on cmtrace.com instead.