PowerShell to get SCCM GUID

PowerShell to get SCCM GUID

get-wmiobject -ComputerName '.' -Namespace root\ccm -Query "Select ClientID from CCM_Client" |Select ClientID

Quick way to work with the local client GUID

Advertisements

Windows Insider: 14946 doesn’t like 3rd party antivirus or encryption

1471524244-4735Heads up

Released this morning on Oct 13th 2016 if you have any of the following a very strong chance of in place upgrade trying then rolling back.  Surprised I don’t see McAfee a

  • Bitdefender, Kaspersky Antivirus, F-Secure Antivirus and Malwarebytes installed on your PC

Solution: Outlook (2007, 2010, 2013, O365) prompts me for credentials each time I open

Background

When your IT administrators update their exchange server or you switch to a new DNS alias or up in the cloud windows adds these new Generic Credentials into the Credentials Vault of your user account.  When more than one exists for a single account Outlook gets confused and prompts you.

Solution

  1. Close Microsoft Office
  2. Windows 7 and before
    1. From the Windows Start button, select Control Panel
    2. Click User Accounts
    3. Click Credentials Manager
  3. Windows 8
    1. Start button
    2. Type in Windows Credentials Manager
    3. Select Settings on the left side
    4. Select  Windows Credentials Manager
  4. Windows 10
    1. Start Button
    2. Type in Credential Manager
    3. Select Windows Credentials
  5. In the Generic Credentials section (bottom)
    1. For local installs (not O365)
      1. You’re looking for credentials that begin MS.Outlook or something similar for your mail server (It will be obvious)
      2. For each credential that begins with MS.Outlook
        1. Click the details button drop down (circle with a downward arrow next to the Modified date)
        2. Click Remove
      3. Repeat steps for each credential that begins MS.Outlook
    2. O365
      1. You’re looking for MicrosoftOffice16_Data:SSPI:EMAIL@ADDRESS.COM
      2. This is your primary credentails this should be taken with great care upon removal as you will need to resync O365 again afterwards
  6. Close the Credentials Manager and Control Panel
  7. Launch Outlook
  8. You should be prompted for each account in Outlook
    1. You should only be prompted on this initial startup

 

Another fun tip to make outlook run better is to use the/CleanFreeBusy start up switch.

/cleanfreebusy Clears and regenerates free/busy information. This switch can only be used when you are able to connect to your Microsoft Exchange server. 2000, 2002/XP, 2003, 2007, 2010

The /CleanFreeBusy switch will reset all of your pending Outlook meeting invites.  This will clear any conflicts and again make Outlook faster.  This was deprecated for 2013.

For Office 2013, 2016, and O365 you use this: https://support.microsoft.com/en-us/kb/2555008

Great Reference for Outlook Command Lines 

From a Post Mr.Brown

Make sure the time on all your servers is in sync. If the time on two of your domain controllers is off by more than 5 mins you will get this for some clients. It took me two days to narrow it down and once I fixed the time on one of my servers all the weirdness went away.

Query: Identify ConfigMgr (SCCM) collections based on Active Directory OU membership

The question came up recently on how to identify which collections are based on Active Directory OU membership in Microsoft System Center Configuration Manager (SCCM) Current Branch

There are tons of guides on how to setup a collection based on OU membership.. but now that you have.. how many have you created?

This is quite simple direct SQL query:

SELECT [CollectionID]
      ,[RuleName]
      ,[QueryID]
      ,[QueryExpression]
      ,[LimitToCollectionID]
  FROM [SMS_ABC].[dbo].[v_CollectionRuleQuery]
  where QueryExpression like ‘%System_OU%’

Issues:

*  not all collection memberships need to be based on System OU.  Varitations will be needed based on requirements

* The above query is based on a view.  If you want to see the SQL you would query the table Collection_Rules_SQL

Useful Tip

The SQL table Collection_Rules_SQL also has the WQL versions of the same query.  This is extremely useful for figuring out the SQL tables involved with any WQL query from collections or the Query node.  You can also get this translation from the SMSProv.log file but that is like searching for a needle in a hay stack while the hack stack is getting bigger and may disappear in a roll over.

smsprovlog-wql-to-sql

A nice bit of documentation at Creating Custom Reports by Using SQL Server Views in System Center 2012 Configuration Manager

Otherwise, happy spelunking!

Music Library Cleaning with PowerShell – Removing Missing Files from iTunes

powershellrings

At the bottom of this post I originally wrote a VBS that deletes files out of ITunes if the location does not exist.  I did the rewrite into PowerShell…

(new-object –com itunes.application).LibraryPlaylist.Tracks | ?{ $_.Location -eq $null } | %{ $_.Delete() }

 

The PowerShell above only removes the item out of ITunes if the location is NULL.  I need to put in a step to check to see if the location is valid.

ITTrackKindFile = 1

deletedTracks = 0

on error resume next



set iTunesApp = WScript.CreateObject("iTunes.Application")

set mainLibrary = iTunesApp.LibraryPlaylist

set tracks = mainLibrary.Tracks

Set FSO = CreateObject("Scripting.FileSystemObject")



for each currTrack in tracks

	' is this a file track?

	if (currTrack.Kind = ITTrackKindFile) then

		' yes, does it have an empty location?

		if (currTrack.Location = "") 		then 

			' yes, delete it

			wscript.echo currtrack.name & " - " & currTrack.Location

			currTrack.Delete()

			deletedTracks = deletedTracks + 1

		else

			'wscript.echo currTrack.Location

			if not fso.fileExists(currTrack.Location) then

				wscript.echo currTrack.name & currTrack.Location

				pause

			end if	

		end if

	end if

next 



wscript.echo "-----------------------------------------------------"

wscript.echo "deletedTracks = " & deletedTracks

Music Library Cleaning with PowerShell – Identifying Old MP3 Files with Low Bitrates

cleanup

Over the past couple of years I travel quite a lot.  As such, I tend to load up on digital format. However, some of my older files have some nasty names or bad quality.

This has led to me to start grooming my 15,000+ song catalog.  That number does not include another 15,000+ audio book files.  I love to listen to books while running.

As I was going through the folders of CD rips, iTunes purchases, and other sundry file droppings… I was feeling a bit overwhelmed.

Trying to scope the issue I went for the following categories

  • ITunes Music
  • Files below a certain Bitrate Threshold
  • Artists I did not enjoy
  • CD Tagging

Today I am going to talk about how I used PowerShell to identify files below a certain bitrate threshold.   Example, I want to get all MP3 files with a bit rate less than or equal to 100.  Then I want to delete them… as they sound even worse on digital players (like the iPhone)

  1. Run the PowerShell Function Get-Mp3FilesLessThan with up to three inputs
    1. Inputs
      1. Directory
      2. BitRate
      3. File Extension
    2. Example
      1. Get-Mp3FilesLessThan \\Server\Music 100 *.mp3 | Format-Wide
    3. Output
      1. List of all files where criteria are matched
  2. Delete result site
    1. Get-Mp3FilesLessThan \\Server\Music100 *.mp3 | Remove-Item -WhatIf
      1. I like using –WhatIf because Remove-Item by default does not show results
      2. Remove the –WhatIf to commit the change

Enjoy!

function Get-Mp3FilesLessThan( [string]$directory = "$pwd", [int]$minimumBitrate = 32, [string]$FileTypeExt = "*.mp3" ) {
  $shellObject = New-Object -ComObject Shell.Application
  $bitrateAttribute = 0

  # Find all mp3 files under the given directory
  $mp3Files = Get-ChildItem $directory -recurse -filter $FileTypeExt
  foreach( $file in $mp3Files ) {
    # Get a shell object to retrieve file metadata.
    $directoryObject = $shellObject.NameSpace( $file.Directory.FullName )
    $fileObject = $directoryObject.ParseName( $file.Name )

    # Find the index of the bit rate attribute, if necessary.
    for( $index = 5; -not $bitrateAttribute; ++$index ) {
      $name = $directoryObject.GetDetailsOf( $directoryObject.Items, $index )
      if( $name -eq 'Bit rate' ) { $bitrateAttribute = $index }
    }

    # Get the bit rate of the file.
    $bitrateString = $directoryObject.GetDetailsOf( $fileObject, $bitrateAttribute )
    if( $bitrateString -match '\d+' ) { [int]$bitrate = $matches[0] }
    else { $bitrate = -1 }

    # If the file has less than or equal to the desired bit rate, include it in the results.
    if( $bitrate -le $minimumBitrate ) { $file }
  }
}

MyITForum: Then of an era

I have been an avid user, contributor, speaker, and blogger on www.myitforum.com since 2005.  It has been an amazing journey.  However with the most current owners a lot of great content is disappearing.  As such I am attempting to grab content before it disappears completely.

The email lists are by far the best part still.

As such sorry for all the ancient posts coming over in the next few days.

http://myitforum.com/myitforumwp/author/scassells/