Wednesday, 1 March 2017

How to find duplicate objects in SCCM




Following you have some useful reports to be able to deal with duplicated objects in SCCM:
Duplicate MAC Addresses.
I normally see this in environments where VDI is common. Generally, a VDI admin has duplicated machines without giving each a unique MAC address. This is bad and should be avoided. If you’re VDI admin has created a bunch of computers with the same MAC, we need to delete them from SCCM. To find these objects, run the following TSQL query:

SELECT 
dbo.v_RA_System_MACAddresses.MAC_Addresses0,
Count(dbo.v_R_System.Name0) AS SystemCount 
FROM dbo.v_R_System RIGHT OUTER JOIN dbo.v_RA_System_MACAddresses 
ON dbo.v_R_System.ResourceID = dbo.v_RA_System_MACAddresses.ResourceID 
GROUP BY dbo.v_RA_System_MACAddresses.MAC_Addresses0 ORDER BY SystemCount DESC
Duplicate Computer Names.
These are the most common duplicate objects. Most likely this occurs due to OSD or conflicting discovery cycles. We basically end up with two computer objects, with the same name/hardware/MAC but different SMSBIOSGUID. It causes much confusion for ConfigMgr because it often doesn’t know how to process the inventory for the phantom object. To find these objects, create an SCCM Query (or query based collection) with the following Query Statement:

select R.ResourceID,
R.ResourceType,
R.Name,R.SMSUniqueIdentifier,
R.ResourceDomainORWorkgroup,R.Client from SMS_R_System as r 
full join SMS_R_System as s1 on s1.ResourceId = r.ResourceId 
full join SMS_R_System as s2 on s2.Name = s1.Name 
where s1.Name = s2.Name and s1.ResourceId != s2.ResourceId

Duplicate HardwareID’s
One other way to look for dupes is to use the HardwareID. Use the following TSQL to find the objects with duplicate HardwareIDs:

SELECT Name0, Hardware_ID0, Count(Hardware_ID0) AS SystemCount
FROM dbo.v_R_System
GROUP BY Hardware_ID0, Name0
ORDER BY SystemCount DESC


Monday, 6 February 2017

Query for Workstations with low disk space (less than 5GB)








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 ,
SMS_G_System_LOGICAL_DISK.FreeSpace,
SMS_G_System_LOGICAL_DISK.Size
from 
SMS_R_System 
inner join SMS_G_System_LOGICAL_DISK on SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId

where
SMS_G_System_LOGICAL_DISK.FreeSpace < 5000

Tuesday, 3 January 2017

CcmSetup failed with error code 0x80070307 Windows 10





CcmSetup failed with error code 0x80070307

When testing the latest Build of Windows 10 I got an error installing the Configuration Manager 2012 R2 client, it fails installing the Windows Update agent with the following error in the CCMSetup.log file.

“File ‘C:\WINDOWS\ccmsetup\WindowsUpdateAgent30-x64.exe’ returned failure exit code 775. Fail the installation.”


I assume a solution to this error will presented soon, but I cannot wait to get started with my testing of 10049 so installing the SCCM Client with the following command line solves at least the installation error of the Configuration Manager client.


- ccmsetup.exe  /skipprereq:WindowsUpdateAgent30-x86.exe

- ccmsetup.exe  /skipprereq:WindowsUpdateAgent30-x64.exe

Then ccmsetup.exe will skip the installation of the Windows Update Agent and continue the installation anyway. Normally I use the /Skipprereq: command to skip the installation of Silverlight on servers as I don’t want Silverlight installed on my servers. But the command line works great in this case as well.

You will then see this in the ccmsetup.log file on the client which shows that the installation of the Windows Update agent was skipped and that the installation continues.


“Item ‘x64/WindowsUpdateAgent30-x64.exe’ is excluded by the ‘/skipprereq:’ switch. Ignore it.”


God Luck with the testing of Windows 1o!


Update: SCCM 2012 SP2 and SCCM 2012 R2 Sp1 solves the problem so to solve the issue and get OSD working an upgrade is needed. If you just want the client to work and cannot upgrade now, the workaround is valid for newer releases of Windows 10 as well
.

Tuesday, 6 December 2016

All Windows 7 x86 Workstations - All Windows 7 x64 Workstations

X86
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_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.SystemType = "X86-based PC" and SMS_G_System_OPERATING_SYSTEM.Caption like "Microsoft Windows 
7%"

X64
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_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.SystemType = "x64-based PC" and SMS_G_System_OPERATING_SYSTEM.Caption like "Microsoft Windows 7%"

Monday, 7 November 2016

SCCM Query computers inactive 45days


This is a query to find out all the Workstations that are been inactive for the last 45 days 
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 where SMS_R_System.Name in (select Name from SMS_R_System where ((DATEDIFF(day, SMS_R_SYSTEM.AgentTime, getdate()) >=45) and AgentName = "SMS_AD_SYSTEM_DISCOVERY_AGENT")) and SMS_R_System.Name in (select Name from SMS_R_System where ((DATEDIFF(day, SMS_R_SYSTEM.AgentTime, getdate()) >=45) and AgentName = "Heartbeat Discovery"))

Monday, 3 October 2016

SCCM Device Collection for Windows 10 Computers


Query


As many companies are migrating to Windows 10, here you have the query to find them in your SCCM.



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_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.BuildNumber = "10240"

Monday, 5 September 2016

Command-line switches for Microsoft Office Outlook 2007





The command that starts Microsoft Office Outlook 2007 is outlook.exe. A command-line switch is the addition of a forward slash followed by the command name and any parameters.

Use a switch once by adding it to the Run command

First, verify the location of the outlook.exe file on your computer. If you accepted the default folder locations when you installed Office Outlook 2007, the outlook.exe file is located at the following:
c:\program files\microsoft office\office12\outlook.exe
If you do not find the outlook.exe file at that location, search for the file and make a note of the full path.
  1. Do one of the following:
    • Windows Vista    
      • Click the Windows Start button Button image , point to All Programs, click Accessories, and then click Run.
    • Microsoft Windows XP or Microsoft Windows Server 2003    
      • Click the Windows Start button, and then click Run.
  2. In the Run dialog box, type a quotation mark, enter the full path for the outlook.exe file, and then type another quotation mark. Alternatively, click Browse to locate and select the file. In this case, the quotation marks are supplied automatically.
  3. After the closing quotation mark, type a space, and then type the switch. For example, you might type:
    "c:\program files\microsoft office\office12\outlook.exe" /nopreview
The next time that you start Office Outlook 2007, the program opens normally. To make your customized startup available for repeated uses, see the next section.
NOTE: 
  • Switches are not case-sensitive. For example, /NOPREVIEW functions the same as /nopreview.
  • Remember to include one blank space before the switch and one before each parameter.

Make a switch available for reuse by creating a shortcut

First, verify the location of the outlook.exe file on your computer. If you accepted the default folder locations when you installed Office Outlook 2007, the outlook.exe file is probably located at the following:
c:\program files\microsoft office\office12\outlook.exe
If you do not find the outlook.exe file at that location, search for the file and make a note of the full path.
  1. Right-click the Windows desktop, point to New, and then click Shortcut on the shortcut menu.
  2. In the Create Shortcut Wizard, in the Type the location of the item box, type a quotation mark, enter the full path for the outlook.exe file, and then type another quotation mark. Alternatively, click Browse to locate and select the file. In this case, the quotation marks are supplied automatically.
  3. After the closing quotation mark, type a space, and then type the switch and any parameters. For example, you might type:
    "c:\program files\microsoft office\office12\outlook.exe" /nopreview
    NOTE: If the parameter is a path to a location on your computer, it also must be enclosed in double quotation marks.
  4. Click Next.
  5. In the Type a name for this shortcut box, type a name for the shortcut, and then click Finish.
    The wizard creates the shortcut on the desktop.
  6. Whenever you want to start Office Outlook 2007 in this particular customized way, double-click the shortcut.
    TIP: To add the desktop shortcut to the Windows Start menu, right-click the shortcut, and then click Pin to Start menu on the shortcut menu.
You can create a variety of shortcuts, each of which applies different switches and parameters to the program at startup.
NOTE: 
  • Switches are not case-sensitive. For example, /NOPREVIEW functions the same as /nopreview.
  • Remember to include one blank space before the switch and one before each parameter.


Switch  Description
/a           Creates an item with the specified file as an attachment.
Example:
"c:\program files\microsoft office\office12\outlook.exe" /a "c:\my documents\labels.doc"
If no item type is specified, IPM.Note is assumed. Cannot be used with message classes that are not based on Outlook.
/altvba otmfilename    Opens the VBA program specified in otmfilename, rather than %appdata%\microsoft\outlook\vbaproject.otm.
/c messageclass              Creates a new item of the specified message class (Outlook forms or any other valid MAPI form).
Examples:
•             /c ipm.activity creates a Journal entry
•             /c ipm.appointment creates an appointment
•             /c ipm.contact creates a contact
•             /c ipm.note creates an e-mail message
•             /c ipm.stickynote creates a note
•             /c ipm.task creates a task
/checkclient      Prompts for the default manager of e-mail, news, and contacts.
/cleancategories             Deletes any custom category names that you have created. Restores categories to the default names.
/cleanclientrules            Starts Outlook and deletes client-based rules.
/cleandmrecords            Deletes the logging records saved when a manager or a delegate declines a meeting.
/cleanfinders    Resets all Search Folders in the Microsoft Exchange mailbox for only the first profile opened.
/cleanfreebusy                Clears and regenerates free/busy information. This switch can be used only when you are able to connect to the server running Exchange.
/cleanprofile    Removes invalid profile keys and re-creates default registry keys where applicable.
/cleanreminders             Clears and regenerates reminders.
/cleanroamedprefs       All previous roamed preferences are deleted and copied again from the local settings on the computer where this switch is used. This includes the roaming settings for reminders, free/busy grid, working hours, calendar publishing, and RSS rules.
/cleanrules        Starts Outlook and deletes client-based and server-based rules.
/cleanserverrules           Starts Outlook and deletes server-based rules.
/cleansharing   Removes all RSS, Internet Calendar, and SharePoint subscriptions from Account Settings, but leaves all the previously downloaded content on your computer. This is useful if you are unable to delete one of these subscriptions within Office Outlook 2007.
/cleansniff         Overrides the programmatic lockout that determines which of your computers (when running Outlook simultaneously) processes meeting items. The lockout process helps prevent duplicate reminder messages. This switch clears the lockout on the computer it is used, enabling Outlook to process meeting items.
/cleansubscriptions       Deletes the subscription messages and properties for subscription features.
/cleanviews      Restores default views. All custom views that you created are lost.
/embedding      Used without command-line parameters for standard OLE co-create.
/f msgfilename               Opens the specified message file (.msg) or Microsoft Office saved search (.oss).
/finder Opens the Advanced Find dialog box.
/firstrun              Starts Outlook as if it were run for the first time.
/hol holfilename            Opens the specified .hol file.
/ical icsfilename             Opens the specified .ics file.
/importprf prffilename                Starts Outlook and opens/imports the defined MAPI profile (*.prf). If Outlook is already open, queues the profile to be imported on the next clean start.
/launchtraininghelp assetid      Opens a Help window with the Help topic specified in assetid displayed.
/m emailname Provides a way for the user to add an e-mail name to the item. Only works in conjunction with the /c command-line parameter.
Example:
•             Outlook.exe /c ipm.note /m emailname
/nocustomize   Starts Outlook without loading outcmd.dat (customized toolbars).
/noextensions Starts Outlook with extensions turned off, but listed in the Add-In Manager.
/nopreview       Starts Outlook with the Reading Pane off.
/p msgfilename              Prints the specified message (.msg).
/profile profilename    Loads the specified profile. If your profile name contains a space, enclose the profile name in quotation marks (" ").
/profiles             Opens the Choose Profile dialog box regardless of the Options setting on the Tools menu.
/recycle               Starts Outlook by using an existing Outlook window, if one exists. Used in combination with /explorer or /folder.
/remigratecategories   Starts Outlook and and initiates the following commands on the default mailbox:
•             Upgrades colored For Follow Up flags to Office Outlook 2007 color categories.
•             Upgrades calendar labels to Office Outlook 2007 color categories.
•             Adds all categories used on non-mail items into the Master Category List.
NOTE: This is the same command as Upgrade to Color Categories in each Outlook mailbox properties dialog box.
/resetfolders    Restores missing folders at the default delivery location.
/resetfoldernames        Resets default folder names (such as Inbox or Sent Items) to default names in the current Office user interface language.
For example, if you first connect to your mailbox in Outlook by using a Russian user interface, the Russian default folder names cannot be renamed. To change the default folder names to another language, such as Japanese or English, you can use this switch to reset the default folder names after you change the user interface language or install a different language version of Outlook.
/resetformregions         Empties the form regions cache and reloads the form region definitions from the Windows registry.
/resetnavpane Clears and regenerates the Navigation Pane for the current profile.
/resetsearchcriteria      Resets all Instant Search criteria so that the default set of criteria is shown in each module.
/resetsharedfolders      Removes all shared folders from the Navigation Pane.
/resettodobar  Clears and regenerates the To-Do Bar task list for the current profile. The To-Do Bar search folder is deleted and re-created.
/rpcdiag              Opens Outlook and displays the remote procedure call (RPC) connection status dialog box.
/safe     Starts Outlook without Microsoft Exchange Client Extensions (ECE), the Reading Pane, or toolbar customizations. Component Object Model (COM) add-ins are turned off.
/safe:1 Starts Outlook with the Reading Pane off.
/safe:3 Starts Outlook with Microsoft Exchange Client Extensions (ECE) turned off, but listed in the Add-In Manager. Component Object Model (COM) add-ins are turned off.
/safe:4 Starts Outlook without loading outcmd.dat (customized toolbars).
/select foldername       Starts Outlook and opens the specified folder in a new window. For example, to open Outlook and display the default calendar, use: "c:\program files\microsoft office\office12\outlook.exe" /select outlook:calendar.
/share feed://URL/filename
/share stssync://URL
/share web://URL/filename     Specifies a sharing URL to connect to Outlook. For example, use stssync://URL to connect a Windows SharePoint Services 3.0 list to Outlook.
/sniff    Starts Outlook, forces a detection of new meeting requests in the Inbox, and then adds them to the calendar.
/t oftfilename  Opens the specified .oft file.
/v vcffilename Opens the specified .vcf file.
/vcal vcsfilename           Opens the specified .vcs file.

/x xnkfilename                Opens the specified .xnk file.