Posts

I Wrote a Book!

Image
 This is something that I've had in the ol' brainpan for a while, but just now getting it converted into something tangible. Physical Book(s): The Adventures... By Andrew Calhoun Book Preview E-book(s): The Adventures of Mr. Hat - Old Iron Days | Universal Book Links Help You Find Books at Your Favorite Store!

TrueNas SCALE - Rebuild NetData Metrics

 I came across an issue after having some problems with one of my arrays. The metrics for things like network/cpu/etc were no longer loading. Regular console log kept saying "loading defaults" and not much information. After doing some digging I finally found that the DB files used with the metrics became corrupt. The fix is simple enough, rename the old DB files and restart the netdata daemon. First off saw the netdata daemon kept stopping even after starting it. systemctl status netdata What gave this away was finally finding in the NetData log that it had a SQLite error. Log Directory: /var/log/netdata Error Log: error.log Error Entry: SQLite error during database setup, rc = 10 (disk I/O error) I decided to take the hammer approach and rather than attempt to fix the DB files, I just renamed them and started the netdata daemon. DB Directory: /var/cache/netdata DB Files: netdata-meta.db netdata-meta.db-shm netdata-meta.db-wal Here is what I ended up running an...

ChurchApps - Open Source Software

Image
I'd like to call out a special project that some folks I've known for a few years now have going on. It's completely open source and free for any Church. If your church is looking to save money on software or has been looking for a church management system. Go check these folks out! https://churchapps.org/

Other Dabblings

Check out the other side of my blog. Commentary and Reviews

Outlook "Work Offline" Mode

 Since I've mainly only found this in terms of a VB Script. I'm going to post my version of it in PowerShell for anyone who is looking for something similar.  1: #Check if Outlook is online or offline mode 2: $Outlook = New-Object -ComObject Outlook.Application; 3: $State = if ($outlook.session.offline) {"Outlook has been set to work offline mode." } else { "Healthy - Outlook is in online mode." }; 4: $State; 5: 6: 7: #Toggle Outlook to online mode 8: Try { 9: $Outlook = New-Object -ComObject Outlook.Application 10: $State = "Toggle" 11: if ($outlook.session.offline) 12: { 13: $Outlook.ActiveExplorer().CommandBars.ExecuteMSO("ToggleOnline") 14: } 15: else 16: { 17: "Outlook already in online mode." 18: } 19: ConvertTo-Json($State) 20: } 21: Catch 22: { 23: If ($_.Exception.Message.Contains("Class not registered")) 2...

NFT

 Just started dabbling in NFT creation. Feel free to check out what I'm working on (items in collection may vary) https://opensea.io/collection/photography-memories

Pfsense Multi-Lan Simple

Image
 Greetings Folks! It's been a while since I've created a blog post. I recently stood up a Pfsense VM to setup a lab environment. I added a second virtual nic to connect to a separate physical network that would be an extension of the VM lab network. Yes I know I could just make the VM lab network extend to the physical but I wanted to have some easy isolation like bits. Plus get some experience on how to configure the virtual switches. There's lots of different references on how to allow traffic from LAN1 to OPTx and vice versa all over the internet. The simplest was the hardest to really find. So I'm putting here for easy reference. Any to Any rules on LAN1 and OPTx Firewalls

MEMCM Console Extension Node GUID

Recently needed to add some custom console extensions to some new nodes in the CM Console. Found this blog that was extremely useful for figuring out what the guid is for each item in the console. http://brunocm.azurewebsites.net/part-1-a-simple-xml-extension-file/

Enable User Policy for Terminal Servers CM 1906

Image
We found an issue where our Citrix Admins couldn't install software from software center or application catalog. Found the client was refusing user policy. After some digging we found that user policy is disabled by default in 1906 and no GUI way to flip it until CM 1910. You can confirm this with the following sql command. You will have to open the resulting xml blob to view. SELECT SiteControl FROM vSMS_SC_SiteControlXML WHERE SiteCode = 'SiteCode' To make the change to policy you have to make the update via wbemtest and it will be apply to all setting. This becomes a regular client policy setting in 1910. Wbemtest Connect to your site server namespace Enum Instances = SMS_SCI_ClientComp Select “Software Distribution” Open “Props” View Embedded Last one in list Open Verify “Request User Policy On TS” Open “Value” Change to “1 (0x1)” Save object on all dialogs Verify the change via the same SQL from the beginning. SELECT SiteControl FROM vSMS_SC...

DP Content Location Request Powershell

If you ever need to see the DP location list coming from SCCM MP to a client. Here is a nifty script that will let you put in the information and see what it returns. Basically synthetic MP calls for DP Content List. [void] [Reflection.Assembly]::LoadWithPartialName("System.Diagnostics") [void] [Reflection.Assembly]::LoadFile("c:\Microsoft.ConfigurationManagement.Messaging.dll") $ManagementPointSiteCode = "COP" $ManagementPoint = "Server.FQDN.local" $PackageID = "PackageID" $PackageVersion = "PackageVersion" $myDomain = "Domain.Whatever" $myForest = "Forest" $myCustomAdSite = "ADSite" # Set up the objects $httpSender = New-Object -TypeName Microsoft.ConfigurationManagement.Messaging.Sender.Http.HttpSender $clr = New-Object -TypeName Microsoft.ConfigurationManagement.Messaging.Messages.ConfigMgrContentLocationRequest $cmReply = New-Object -TypeName Microsoft.ConfigurationManage...

Move and Resize BranchCache Hash/Data Cache on Distribution Point

This one is pretty self explanatory. If you use BranchCache by default it puts the caches on C: drive and you might find that your C: is the smallest drive (depending on your server configuration). Anyways here is something that will help you move those caches around and set them to a different size. #Check if cache already moved $CacheStatus = Get-BCStatus If(($CacheStatus.HashCache.CacheFileDirectoryPath -like 'E:\')-or($CacheStatus.DataCache.CacheFileDirectoryPath -like 'E:\')) {     Set-BCDataCacheEntryMaxAge -TimeDays 10     Return "Already Moved" } elseif ((Get-Volume -DriveLetter E).FileSystem -ne "NTFS") {     # Set Cache Sizes     get-bchashcache | set-bccache -Percentage 2 -Force -Confirm:$false     get-bcdatacache | set-bccache -Percentage 1 -Force -Confirm:$false     Set-BCDataCacheEntryMaxAge -TimeDays 10     Return "Destination Not NTFS" } else {     #Create New Directories ...

Powershell to enable "Download from Neighbor Boundary" on SCCM Applications

Greetings folks Here is another bit you might find fun and exciting. You ever have the need to setup/modify apps to allow download from neighbors (that little drop down box, not the check box for default boundary). Then you are in luck. Take a look at the following $OutFileName = "C:\EnterLogNameHere.log" $AllApps = Get-CMApplication $Agent99 = $AllApps | Where-Object {$_.LocalizedDisplayName -like "*IfYouWantToLimitIt*"} foreach($appType1 in $Agent99) { $allTypes1 = Get-CMDeploymentType -ApplicationName $appType1.LocalizedDisplayName forEach($appType in $allTypes1) { If ($appType.Technology -contains "MSI") { #"MSI" $appType.LocalizedDisplayName +";"+ $appType.Technology +";"+ "Updated to Download" | Out-File $OutFileName -Append Set-CMMsiDeploymentType -ApplicationId $appType1.CI_ID -DeploymentTypeName $appType.LocalizedDisplayName -SlowNetworkDeploymentMode Download      } elseif ($appType....

Citrix App Layer VDI causing Multiple GUIDs in SCCM

We ran across a head scratcher with some Citrix App Layering VDI machines. What it boiled down to is that the master image didn't have everything cleaned out of the client like we thought. There is apparently a new "feature" in the Citrix system that creates a "Citrix Profile" that SCCM ends up putting a backup file in. The only problem with that is that unless the file is removed from this hidden folder partition. The GUID will be picked up by all the VDIs that are made from that master. Even if you change the GUID on one it will change them on all of them. After Citrix support said it wasn't them MSFT support was able to provide the following useful information to clean up this scenario. For each user VM In the SCCM Console: delete the Computer object for this VM On the VM: net stop CCMexec Del %windir%\smscfg.ini delete SMS certificates open disk manager, Locate the hidden partition "c:\program files\Citrix\pvsvm\Se...

Machine collection based on user AD group

In general I don't recommend anyone do this unless you have to. Especially in environments where a user has more than one machine. Now I know you're thinking 'why not just target users' well that is a good question. In this case I needed to add an exclude collection to the machine collection to prevent installation on certain machines. But if you ever find yourself in such a predicament. Here you go. 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_SYSTEM_CONSOLE_USER on SMS_G_System_SYSTEM_CONSOLE_USER.ResourceID = SMS_R_System.ResourceId inner join SMS_R_User on SMS_R_USER.UniqueUserName = SMS_G_System_SYSTEM_CONSOLE_USER.SystemConsoleUser Where SMS_R_User.UserGroupName = "Domain\\ADGroup"

Hard to reach Registry Hive

Had an instance of needing to reach HKEY_CLASSES_Root with powershell and found it doesn't have an HKCR built in. Ended up finding a post that had a simple solution and wanted to pass it along. For full details see: https://blogs.msdn.microsoft.com/lior/2009/06/18/what-no-hkcr-in-powershell/ Otherwise here is the important bit that I used: New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT

Additional Information using COM object to send email from Powershell

So I found that if you happen to be in an environment were you have more than one mailbox and you have permissions to send from that other mailbox. You might think that just using the From attribute in the object would send your email from that other mailbox. Well if you thought that you would find you are mistaken (or at least I was). You have to use the "SentOnBehalfOfName" attribute to be able to make your email send from that other mailbox. Here is a handy little function to give you a hand. function Send-Email ( [string] $ Address , [string] $ CCAddress , [string] $ BCCAddress , [string] $ Subject , [string] $ HTMLBody , [string] $ FromAddress) { $ Outlook = New-Object - ComObject Outlook.Application $ Mail = $ Outlook .CreateItem ( 0 ) If(!( [string] ::IsNullOrWhiteSpace ($ FromAddress ))) { $ Mail .SentOnBehalfOfName = $ FromAddress } If (!( [string] ::IsNullOrWhiteSpace ($ CCAddress ))) { $ Mail .CC = $ CCAddress...

Intune Hybrid - NDES Cert Issue

As many of you who might be running a SCCM/Intune hybrid scenario for MDM will have learned. There are a few to many certificates in use between NDES, Intune, Wifi Profiles, VPN profiles, and well anything else that may have a cert buried in it. We had an instance were the NDES wasn't handing out the certs for WiFi and VPN profiles. However it was handing out the base communication certificate so phones could sync correctly. This was one of those head scratchers on our park, but if you know where to look it makes sense. Problem is (at least in my opinion) there is a lack of useful documentation and the logging leaves a little to be desired. Therefore, I'm going to give a bit about our journey and hopefully help some of you folks out if you run into something similar. When we were notified of this issue, we started to look at the usual logs, you know CRP.log NDESPlugin.log those types of things. First thing you will notice is that the CRP.log will show the same message ove...

Trigger Manual DEP Sync With Powershell

Greetings fellow admins! Here is another good one that I spent a few hours digging into WMI and SMSProv verbose logging. Plus some random WMI class calls. Hopefully this will help you fill in somethings missing from the SDK/MSDN documentation. $wmidate = new-object -com Wbemscripting.swbemdatetime $date = get-date -format g $wmidate . SetVarDate( $date , $true ) [ void ] ( $thisInstance = ( [ wmiclass ] " \\localhost\root\sms\site_COP:SMS_ActionAccountResult " ) . createinstance() ) [ void ] ( $thisInstance . ActionID = 1 ) [ void ] ( $thisInstance . StartTime = $wmidate . value) [ void ] ( $thisInstance . Put()) $date = get-date -format g $wmidate . SetVarDate( $date , $true ) [ void ] ( $thisInstance = ( [ wmiclass ] " \\localhost\root\sms\site_COP:SMS_ActionAccountResult " ) . createinstance() ) [ void ] ( $thisInstance . ActionID = 2 ) [ void ] ( $thisInstance . ActionData = 'syncType,fullSyn...

Packages missing SMB share information

Well came across another interesting one today. We had an OSD package that wasn't working in run from dp. Ended up being an issue very similar to the issue that occurs if you have a pull dp under a secondary site. Based on some talks with support on the other issue, here is a handy query to identify the issue. You can also give this query and the results to CSS to help them resolve your issue faster. -- Broken Packages select cdpm.SiteCode, ContentID,ServerName,AccessType,URL,URLSubPath,URLProtocol,vpkg.Name from ContentDPMap as cdpm join v_Package as vpkg on vpkg.PackageID = cdpm.ContentID where cdpm.AccessType = 2 --UNCProtocol and cdpm.URLSubPath = '\' --Packages with issues only have a '\' and vpkg.PkgFlags = (vpkg.PkgFlags | 0x80) --Limit to only show packages with the 'Copy To Package Share' flag set Now for the !!!!!!DON'T TRY THIS AT HOME (Production)!!!!!! section. I recommend that you contact CSS but to help point them in the right ...

Using an Outlook Object to send email

Greetings fellow travels. It has been a while since I have posted anything so I thought I would add a small tidbit to answer that question of "How do I send a freak'n email?" of course this version uses your MSFT Outlook client. It is very difficult, so difficult I went "That's It" and was in shock that is was actually that simple. The other caveat is that this sends the email in HTML format so you can add all your favorite HTML tags. This is a really simple version and I didn't get very deep but there is lots of things you can actually do with the email. There are several good pages on the web that go into greater detail and get more in depth (and complex). But for my needs this is more than enough. Enjoy! $Outlook = New-Object -ComObject Outlook.Application $Mail = $Outlook.CreateItem(0) $Mail.To = $Address If (!([string]::IsNullOrWhiteSpace($CCAddress))) {     $Mail.CC = $CCAddress } $Mail.Subject = $Subject $Mail.HTMLBody = $HtmlBo...