Categories
ConfigMgr

ConfigMgr : KB2840628 Workaround and Taking Control of a CONFIGMGRSEC Database

Came up against the known ConfigMgr issues associated with KB2840628 today. Initially I noticed that one of the Distribution Point Groups I have was showing content replication for a large number of packages as ‘In Progress’ – these dated back over the last few days: 

DPstats

So I then noticed that the Database Replication for the Secondary Site where these Distribution Points were had failed. Digging a little deeper I had a strange .Net error in rcmctrl.log on the Secondary Site server:

{code lang:text showtitle:false lines:false hidden:false}Asynchronous command finished with return message: [A .NET Framework error occurred during execution of user-defined routine or aggregate “spDRSActivation”: ~~System.TypeInitializationException: The type initializer for ‘System.Data.SqlClient.SqlConnection’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘System.Data.SqlClient.SqlConnectionFactory’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘System.Data.SqlClient.SqlPerformanceCounters’ threw an exception. —> System.MethodAccessException: Attempt by method ‘System.Configuration.TypeUtil.CreateInstanceRestricted(System.Type, System.Type)’ to access method ‘System.Diagnostics.SwitchElementsCollection..ctor()’ failed. —> System.Security.SecurityException: Request failed.~~System.Security.SecurityException: ~~ at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)~~ at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)~~ at System.Security.PermissionListSet.CheckSetDemandWithModification(PermissionSet pset, PermissionSet& alteredDemandSet, RuntimeMethodHandleInternal rmh)~~ at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh)~~ at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)~~ at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)~~System.TypeInitializationException: ~~ at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()~~ at Microsoft.ConfigurationManager.DataReplicationService.DatabaseOperation.ExecuteNonQuery(String commandText)~~ at Microsoft.ConfigurationManager.DataReplicationService.MessageHandl…].{/code}

More info available on this known issue here:
http://blogs.technet.com/b/configmgrteam/archive/2013/07/17/issues-reported-with-ms13-052-kb2840628-and-configmgr.aspx

The supplied workaround required using SQL Management Studio to perform the following:

SQL Server -> Databases -> (Site Database) -> Programmability -> Assemblies -> MessageHandlerService ->Right-click and select Properties and highlight -> General -> Expand the “Permissions Set” drop-down -> Select Unrestricted.
When the change is made, replication between sites should automatically recover within 5-10 minutes.

Also, the same is required for the SMSSQLCLR assembly Permission; SQL Server -> Databases -> (Site Database) -> Programmability -> Assemblies -> SMSSQLCLR

Of course, when ConfigMgr deploys a Secondary Site SQL instance there is a limited set of users defined that have SYSADMIN access to the instance. To perform this changes I needed SYSADMIN access.

Using the SysInternals tools, specifically PSExec I was able to grant myself these permissions:

{code lang:text showtitle:false lines:false hidden:false}:: Launch cmd.exe via PSexec in SYSTEM Context
psexec -s cmd

:: Create new login and add to SYSADMIN role
osql -E -S SRV1\INSTANCE -Q “sp_grantlogin ‘DOMAIN\user'”
osql -E -S SRV1\INSTANCE -Q “sp_addsrvrolemember @loginame=’DOMAIN\user’, @rolename=’sysadmin'”
{/code}

I could then make the required changes – once completed the content that was stuck ‘In Progress’ slowly transitioned to a ‘Success’ status.

 

Categories
ConfigMgr

ConfigMgr : Deployment Update Failed 80091007

Strange one this… I recently released a new version of a product in ConfigMgr, configured supersedence and waited for the defined uninstall/update to occur – only it didn’t. The software appeared to download on the client as expected (both old and new version) and then without any update in AppEnforce.log the deployment failed with an 80091007 error code.

On further investigation CAS.log contained the following:

{code lang:ini showtitle:false lines:false hidden:false}Download completed for content Content_1a0a6203-e945-4228-911c-3e3f7b6082aa.1 under context System ContentAccess 21/07/2013 16:48:36 9600 (0x2580)
Computed hash: 5AEBBE1E909AF384387E804ABCE3C8C71BBA007B433731766C0734EE44A28938 ContentAccess 21/07/2013 16:48:36 9600 (0x2580)
Failed to do hash verification with preference : 4. Try to verify at next hash algorithm ContentAccess 21/07/2013 16:48:36 9600 (0x2580)
Download failed for content Content_1a0a6203-e945-4228-911c-3e3f7b6082aa.1 under context System, error 0x80091007 ContentAccess 21/07/2013 16:48:36 9600 (0x2580){/code}

Content hash verification had failed.. strange as the MSI had been tested and was working. I simply updated the deployment content , waited for this to distribute and tested again without issue…!

Categories
Microsoft

Windows 8.1 Preview : 24-hours In

So in a moment of madness following TechEd Europe 2013 I decided to upgrade my Surface RT and Windows 8 PC to 8.1 Preview; 24 hours later I thought I’d share my findings and thoughts so far; jump menu:

Categories
ConfigMgr

ConfigMgr 2012 ; CcmExec.exe Exception code: 0xeeeefffe

I’ve had this crop up randomly on a number of machines now – software/update deployment stops working.  On investigation the SMS Host Agent service is not running. When restarted the service wont stay started – the system event log on the client is populated with the following errors:

{code lang:xml showtitle:false lines:false hidden:false}Log Name: Application
Source: Application Error
Date: 14/02/2013 09:14:34
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: <Client FQDN>
Description:
Faulting application name: CcmExec.exe, version: 5.0.7804.1000, time stamp: 0x50add095
Faulting module name: KERNELBASE.dll, version: 6.1.7600.16850, time stamp: 0x4e21132b
Exception code: 0xeeeefffe
Fault offset: 0x00009673
Faulting process id: 0xd74
Faulting application start time: 0x01ce0a939470cbdb
Faulting application path: C:\Windows\CCM\CcmExec.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: f1e3ad5b-7686-11e2-abf7-5c260a383293{/code}

Thanks to linkess from the TechNet forums I revised all of my Boundary Groups, creating a set of Boundary Groups that assign servers for content only, and a set of Boundary Groups for Site Code assignment (no servers listed in these).

I also ensured that only servers from the correct site were listed under each content group.

Categories
Windows 2008

Windows 2008 R2 ; Update Computer Account Group Membership Online

Useful if you use groups for certificate enrolment etc; you can update the computers group membership without having to reboot the server using the following process:

  1. From an elevated command prompt run the command: klist -lh 0 -li 0x3e7 purge
  2. Then enumerate computer group membership again using: gpupdate /force
Categories
Windows 2008

Windows ; Disconnected RDP Session Search and Destroy!

Every so often I’ll end up with a disconnected RDP session somewhere which causes chaos come password reset day; locking my account out etc. I came across the following script over at http://www.akaplan.com/blog/ which will search for RDP/RDS sessions on every server in a domain for a particular user. Run using cscript.exe serversessions.vbs. Click Read More for the script.

Categories
ConfigMgr

ConfigMgr 2012 ; Automatic Deployment Rule 0x80072efd

During deployment/configuration I ran into an issue where the Automatic Deployment Rule started failing. Tracing traffic via WireShark showed that a proxy server had been picked up (probably from a WPAD DNS entry) and as a result the ADR was failing to download.

Ruleengine.log showed: ‘Failed to download the update from the internet. Error = 12029’

Patchdownloader.log (careful as this changes location if the client is installed): ERROR: DownloadContentFiles() failed with hr=0x80072efd

To resolve I executed the following commands on the Primary Site Server (if you have a CAS then ensure you execute the command on the CAS server):

  • bitsadmin /Util /SetIEProxy LOCALSYSTEM NO_PROXY
  • bitsadmin /Util /SetIEProxy NETWORKSERVICE NO_PROXY       

 

By default these will be set to AUTODETECT – I can only guess that the server was picking up a proxy server from another domain in the environment.

Categories
Exchange Server 2010

Exchange 2010 ; Mailbox Statistics with sAMAccountName

I needed to get mailbox statistics, alongside user sAMAccountName in order to plan an Exchnage 2010 migration; the script below is a modified version of one I found here. Save as a “.ps1” file and run from the Exchange Management Shell, the script will create a csv file under C:\Temp.

{code lang:php showtitle:false lines:false hidden:false}$r=@()
get-mailboxdatabase * | get-mailbox -resultsize unlimited | foreach {$l = “”| Select sAMAccountName,displayName,Size,serverName,databaseName,ItemCount; $l.sAMAccountName = $_.samaccountname; $l.Size =
 (get-mailboxstatistics -id $_.distinguishedname).totalitemsize; $l.displayName = $_.DisplayName; $l.ItemCount = (get-mailboxstatistics -id $_.distinguishedname).ItemCount; $l.databaseName = $_.database; $l.serverName = $_.serverName; $r += $l};
$r | export-csv c:\Temp\Sizing.csv -notype -encoding ascii {/code}

 

Categories
Windows 7

Windows 7 : SoftAP / Access Point Configuration

So I recently needed to share a 3G USB connection from a Windows 7 laptop with a variety of different devices; it turns out that this funcitonality is built-in to the OS and can be configured in a few simple steps. There are some GUI-type tools available to help you perform this operation should you want to simplify it…

Check for SoftAP Support

Execute the following command:
{code lang:ini showtitle:false lines:false hidden:false}netsh wlan show drivers{/code}

Look for “Hosted network supported  : Yes”, provided this is supported you’re good to go. If this is not supported make sure you are running the most recent version of the drivers for your wireless card, if you are then unfortunately there isn’t anything else you can do…

Configuring the SoftAP

Now, from an Administrative command prompt execute the following commands:
{code lang:ini showtitle:false lines:false hidden:false}netsh wlan set hostednetwork ssid=PRVNet key=MyPassword1 keyUsage=persistent{/code}

Configure your Internet Connection for Sharing

Modify your “internet connected” adapter so that sharing is enabled, you also need to select the correct home networking connection that you want to share the connection with – make sure you select the new Microsoft Virtual Wifi Miniport adapter.

Enabling the SoftAP

Use the following command to switch on the SoftAP:
{code lang:ini showtitle:false lines:false hidden:false}netsh wlan start hostednetwork{/code}

You should be able to connect to your new SoftAP now.

Disabling the SoftAP

To disable the SoftAP execute the command:
{code lang:ini showtitle:false lines:false hidden:false}netsh wlan stop hostednetwork{/code}

Categories
SQL

SQL : Find & Disconnect Database Sessions

When taking a database offline you may find the offline process takes a long time or may fail due to existing connections. You can use the following SQL to identify user sessions that are connected to a particular database:

{code lang:sql showtitle:false lines:false hidden:false}USE MASTER
SELECT * FROM sysprocesses WHERE dbid = DB_ID(‘APPV’){/code}

Using the SPID from the output above kill any identified session by using the simple SQL below:

{code lang:sql showtitle:false lines:false hidden:false}kill <session ID>{/code}