Sunday 15 April 2012

All POWERSHELL Scripts !!!!!!

  • ConfigMgr 2007 (SCCM)
  • DPM 2007
  • DPM 2010
  • OpsMgr 2007 (SCOM)
  • SCE 2007 / 2010 (Essentials) 
  • SCVMM / Hyper-V
  • Service Manager (SCSM) 2010 / 2012
  • Miscellaneous
ConfigMgr 2007 (SCCM)
 Top of Page
DPM 2007 (DPM 2010/2012 Compatible)
Top of Page
OpsMgr 2007 (SCOM)
Automating Agent Discovery and Failover Configuration
OpsMgr Groups
Series: Exploring OpsMgr Class Lineage
MP Authoring and SDK
Series: How to create two-state monitors in OpsMgr with R2 PowerShell modules
Series: How to create two-state monitors in OpsMgr with R2 PowerShell modules
Additional Authoring and SDK
Monitoring
FTP Monitoring
Top of Page
SCE 2007 / 2010 (Essentials) 
Top of Page
SCVMM / Hyper-V
Hyper-V PowerShell Series
Top of Page
Service Manager 2010 / 2012
Top of Page
Miscellaneous
File System
SQL
Admin and Automation
FTP

Monday 12 March 2012

System Center (DPM) 2012 CTP for Windows Server "8" Beta support

The CTP enables the Data Protection Manager component's repository and agents to run on Windows Server ‘8” as well as providing protection in Windows Server “8” environments. The CTP also adds protection for new features in Windows Server “8”:

image
  • Hyper-V Virtual Machines on Cluster Shared Volumes 2.0 (CSV2.0)
  • Hyper-V Virtual Machines on remote SMB share
  • Files on De-Duplicated Volumes
More and download here

DPM - Replica inconsistent and insufficient disk space on BMR (Bare Metal Recovery) Backup

System Center Data Protection Manager 2010 (DPM 2010) offers with its new console in the creation of a protection group in System Protection, a new option called "Bare Metal Recovery".

This option saves the operating system files (System State) and critical volumes (excluding user data) to restore it very quickly to new hardware.  This feature existed in DPM 2007 with Software Removal Tool.

The problem is that sometimes the BMR backup "Bare Metal Recovery" is not working properly and fails with the message "Replica inconsistent" caused by "insufficient disk space".

Cause:

DPM 2010 does not calculate the size of BMR data source, but assumes 30 GB for all servers. Admins should change the value as per the size of BMR backups expected on their environments.

The size of BMR backup is approximately equal to the amount of space used on all critical volumes.

Critical volumes = Boot Volume + System Volume + Volume hosting system state data such as AD DIT/log volumes.

Solution:

We need to run the BMR backup Manually (without DPM) to know the disk size needed on DPM:

1. Create a shared folder with enough space to store the BMR backup, for example \ \ server_name \ BMR
2. On the production server, launch the command prompt with administrative privileges
3. Then type the following command:

wbadmin.exe start backup -allcritical -quiet -backuptarget:\\server_name\bmrshare 

4. Once the backup is complete, check the disk space consumed by the BMR backup and make sure that the same amount of disk space or more have been allocated to the replica volume.
5. Also increase the disk space of volume recovery point.
6. Then in the DPM console, starts the consistency check on our replica inconsistent

Once these operations are completed the BMR backup will be created and recovery points are available.

External Link :
http://technet.microsoft.com/en-us/library/ff634208.aspx

DPM - EUR not working in combination with DFS

It is not possible for users to restore (their own) files using EUR in situations where DFS (Distributed File System) is in place for the file servers.

Users receive the error message: "There are no previous versions available."

Cause
Previous versions of a file or of a folder in a DFS share are not listed if you access the share through a nested DFS link from a computer that is running Windows 7 or Windows Server 2008 R2.

Hotfix

A supported hotfix is available from Microsoft for the following Operating Systems.
  • Windows 7
  • Windows 7 Service Pack 1 (SP1)
  • Windows Server 2008 R2
  • Windows Server 2008 R2 Service Pack 1 (SP1)
The hotfix is available using this Support link: http://support.microsoft.com/default.aspx?scid=kb;EN-US;2466048

Our experience
The support article describes that this issue only occurs when you try to access the share by DFS name. <\\DFS\fileshare> When you access the share by the file server name it should work. <\\fileserver\fileshare>. However we experienced the issue also when accessing the share using the server name. Both issues where solved by the hotfix.

More info about End User Recovery (EUR)

Data Protection Manager 2010 Overview Poster

The Data Protection Manager (DPM) 2010 Overview poster was made to give an overview and quick reference to DPM's components, architecture, and DPM protection scenarios. It consists of system requirements, licensing, architecture, supported workloads, storage types, design quest.
image

Authors:


Yegor StatsevMicrosoft DPM MVP
Sean O Farrellwww.seanofarrelll.blogspot.com
Steve Buchananwww.buchatech.com

Download: http://gallery.technet.microsoft.com/Data-Protection-Manager-e1835980
Source: http://blogs.technet.com/

DPM reporting fails (after server reinstall)

Reinstallation of DPM with the same server name and database. For instance in the case of hardware replacement. Could lead to failing reports on the DPM server.
Error

An error occurred during client rendering.
An error has occurred during report processing. (rsProcessingAborted)
Cannot create a connection to data source 'DLS'. (rsErrorOpeningConnection)
Cannot open database "DPMDB" requested by the login. The login failed. Login failed for user ‘%servername%\DPMR$%servername%.

CauseAfter recovery of the DPM server to new hardware. The account ‘%servername%\DPMR$%servername%. doesn’t have the correct mappings for the DPM database.
image
Solution
  1. Connect to the MSDPM2010 instance using SQL management dtudio
  2. Expand Security then expand Logins; right-click %servername%\DPMDBReaders$%servername% and select properties
  3. Select User Mapping in the left pane; in the upper right pane, under "Users mapped to this login:" verify DPMDB is selected; In lower right pane, ensure db_datareader and public are both selected; click OK
image

RegKeyToMof v2.6

Original article at : http://myitforum.com/cs2/blogs/skissinger/archive/2011/02/18/mark-cochrane-s-regkeytomof-v2-6.aspx


Mark has updated his excellent RegKeytoMof utility for custom regkey MOF edit creations. The coolest part about it is a better method of pulling in registry keys from the 64-bit registry section.
I'm in love with it, because of how the end result is that there is only 1 table and 1 view in your database, making report writing that much easier (fewer joins).
Major kudos go to Jonas Hettich for figuring out the intricasies of how this type of mof edit works.
This blog entry will step through how to use RegKeytoMof to create a (fictitious) custom mof entry for "ABCStuff"
Below is a screen shot of the registry of a x86 computer, and a x64 computer.

How to Use RegKeytoMof:
  1. While on either the x64 computer or the x86 computer, launch "RegKeyToMofv2.5.exe"
  2. Browse to "Software\ABCStuff"
  3. Change the ClassGroup and ClassName to be values you want
    a. For me, I always change the group to be "CUSTOM", however, if you work for ACME Corporation, you may want to change it to "ACMECorp" for example.  It's really simply a label.
    b. Change the ClassName to be something unique, and no spaces is recommended.  For this edit, I'm going to use "ABCStuff"
  4. Check the box about "Enable 64bits"
Screen shot of the work so far:

Now we have a very, very close base.  Most of the time you could copy the contents of the tabs "SCCM Configuration.mof" and "SCCM sms_def.mof" directly to the bottom of your inboxes\clifiles.src\hinv files, and be golden.
However, for this particular mof edit, I made sure to add in some special cases, that might trip you up.  As mentioned, most of the time you won't have these special cases.
Three things:
  1. I'm asking for the value of the (Default) regkey.  that requires a manual edit.
  2. one of the values I want "MultiSZIWant", contains multiple strings.  In order to pull that information in nicely, there is another manual edit.
  3. one of the values I want "BinaryIwant", also needs a manual edit.
5. To adjust for the (Default) regkey, a label is required.  There are 6 places to put in that label; 4 places in configuration.mof, and 2 in sms_def.mof.
6. To adjust for the multiple string values, there is 4 places to put in braces [], 2 places in configuration.mof, and 2 in sms_def.mof.
7. To adjust for the binary value, there is 4 places to put in braces [], 2 places in configuration.mof, and 2 in sms_def.mof.
Attached is the completed mof edit. 
Notes: I decided to label the default value "TheDefault"  so search for that in the files to see how that was accomplished.  For the multi-values, search for the [] to see where those should be placed.
8. Now follow the wiki, on updating your mof files and confirming the edit worked:
9. Now that you have data in your database, here's a sample sql query, and the resulting report.
 
To interpret what that means...
   9a. workstation1 is a 32-bit OS, and as such, does not have WMI provider architechture that would try to report on 64-bit regkeys (this line in the
sms_def.mof edit:  SMS_Context_1("__ProviderArchitecture=64|uint32").  For that reason, there is only 1 row of data returned for workstation1.
   9b. workstation2 is a 64-bit OS, and does have both providerarchitechtures, 32 and 64.  So it will *attempt* to report on registry keys in both areas, that's why there are two rows of data, but the attributes that correspond to registry keys are null for those that don't exist, and contain data for the ones that do exist.
From a collection query creation standpoint, or from a reporting standpoint, having to look only in 1 location when you design your SQL or WQL queries is a very cool and timesaving thing.  Not only to you, but your database has 1 less table, view, and stored procedures

Script to remove the list of packages from DPs in SCCM

This script will remove the packages given in text file listofpackagesToDelete.txt to that DP


Option Explicit
'On Error Resume Next

Dim objFSO
Dim objTextFile
Dim strNextLine
Dim arrServiceList

Dim WbemServices
Dim loc

Dim DPs, DP

Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer( , "root\SMS\site_999")

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("listofpackagesToDelete.txt", ForReading)


Do Until objTextFile.AtEndOfStream
    'read the next line
    strNextLine = objTextFile.Readline
    arrServiceList = Split(strNextLine , "    ")

    'arrServiceList(0) = packageid, arrServiceList(1) = DP

    Set DPs = wbemServices.ExecQuery("Select * From SMS_DistributionPoint WHERE PackageID='" & arrServiceList(0) & "' AND SiteCode = '" & arrServiceList(1) & "'")

    For Each DP In DPs
        Wscript.Echo  DP.ServerNALPath
        DP.Delete_
    Next
Loop

Error : PXE Boot aborted. Booting to the next device

Sometimes, while trying to boot from PXE server, you might get this error:

Downloaded WDSNBP

Architecture: x64

The details below show the information relating to the PXE boot request for this computer. Please provide these details to your Windows Deployment Services Administrator so that this request can be approved.

Pending Request ID: 45

Contacting Server: 192.168.3.1.
TFTP Download: smsboot\x64\abortpxe.com

PXE Boot aborted. Booting to next device...

To fix this there are two methods: for known computers and unknown computers.

1 Known Computers


If it is an already existing computer that is being reimaged, then you need to 'clear the last PXE advertisement'.
Right click on the Collection and select Clear last PXE advertisement.

After some time, you will find that this method no longer works. Then you can use the below method.

1      Find out the name of the computer you are trying to image. (If you don’t know the name, then try searching by the Mac address). Go to your OS distribution collection.
2      Open the collection properties.
3      Then, create a new direct membership rule. On the Search for the resources page, give Resource class as System Resource, then give the name of the computer.



4      On the select resources page, you will find that there are two entries (the second one is the new one you are imaging). Select both, and them.
5      That’s it. Now SCCM will see your computer and the process will start.


Sometimes, you need to restart the WDS service to make the change effective J

This will work for Known computers.

2 Unknown Computers


For Unknown computers (bare metal), create a new Task sequence advertisement, and point it to the All Unknown Computers collection (this is a built in collection, new in 2007 R2).


Again, restart the WDS Service.

Note: For any troubleshooting, you should check the smspxe.log. It is present at <Local DP>\c$\sms_scc\logs\smspxe.log.

Script to assign a list of packages to list of DPs in SCCM

This script will assign the packages given in text file listofPackageToAssign to that DP

Option Explicit
'On Error Resume Next

Dim objFSO
Dim objTextFile
Dim strNextLine
Dim arrServiceList

Dim loc
Dim WbemServices
Dim distributionPoint
Dim serverName
Dim AllDPs, DP
Dim Site
Dim newDP

Dim wbemFlagReturnImmediately
Dim wbemFlagForwardOnly

wbemFlagReturnImmediately = 16
wbemFlagForwardOnly       = 32

Set loc                   = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices          = loc.ConnectServer( , "root\SMS\site_xxx")

Const ForReading = 1

Set objFSO      = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("E:\DWM Tools\Scripts\listofpackagesToAssign.txt", ForReading)

Do Until objTextFile.AtEndOfStream
    'read the next line
    strNextLine    = objTextFile.ReadLine
    arrServiceList = Split(strNextLine , "    ")

    'arrServiceList(0) = packageid, arrServiceList(1) = DP

    Set AllDPs = wbemServices.ExecQuery("Select * From SMS_SystemResourceList WHERE RoleName='SMS Distribution Point' and SiteCode = '" & arrServiceList(1) & "'")

    For Each DP In AllDPs
        Set Site = WbemServices.Get("SMS_Site='" & DP.SiteCode & "'")
        Set newDP = WbemServices.Get("SMS_DistributionPoint").SpawnInstance_()
        newDP.ServerNALPath = DP.NALPath
        newDP.PackageID = arrServiceList(0)
        newDP.SiteCode = DP.SiteCode
        newDP.SiteName = Site.SiteName
        newDP.Put_
    Next

    ' Display notification text.
    Wscript.Echo "Assigned package: " & arrServiceList(0) & "    to DP: " & arrServiceList(1)

Loop

Script to refresh list of packages to list of DPs in SCCM

This script will refresh the packages given in text file listofpackagesToRefresh.txt to that DP


Option Explicit
On Error Resume Next

Dim objFSO
Dim objTextFile
Dim strNextLine
Dim arrServiceList

Dim WbemServices
Dim loc

Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer( , "root\SMS\site_xxx")

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("E:\DWM Tools\Scripts\listofpackagesToRefresh.txt", ForReading)


Do Until objTextFile.AtEndOfStream
    'read the next line
    strNextLine = objTextFile.Readline
    arrServiceList = Split(strNextLine , "    ")

    'arrServiceList(0) = packageid, arrServiceList(1) = DP
    Wscript.Echo "packageID: " & arrServiceList(0)
    Wscript.Echo "DP : " & arrServiceList(1)



    Set DPs = wbemServices.ExecQuery("Select * From SMS_DistributionPoint WHERE PackageID='" & arrServiceList(0) & "' AND SiteCode = '" & arrServiceList(1) & "'")

    For Each DP In DPs
        Wscript.Echo " Refreshing : " & DP.SiteName
        'DP.RefreshNow = True
        DP.Put_
    Next
Loop

Sunday 11 March 2012

Error - PXE test request failed, status code is -2147467259, 'Error receiving replies from PXE server'.

Sometimes, after your configure WDS on a secondary site server, and then enable PXE role on it, you get the above error in the pxecontrol.log file.


And, the wdsserver service will also not start (error code 87).

Solution:

Change the below regitry key

HKLM\SYSTEM\CurrentControlSet\Services\WDSServer\Providers\WDSPXE\IsCritical from 1 to 0

If you get  error code 10048 while starting the wdsserver service, then do the following:
  1. Click Start, click Run, type wdsmgmt.msc, and then press OK.
  2. In the Windows Deployment Services window, expand Servers, right-click the WDS server name, and then click Properties.
  3. In the Server Properties dialog box, click the DHCP tab.
  4. Click to select the Do not listen on port 67 check box, and then click Apply.

Troubleshooting advertisements stuck in - Waiting for content

Sometimes an Advertisement gets stuck in Waiting state, like this:


Upon viewing the execmgr.log file, you may see this line:


And, in the contentTransfermgr.log, you can see this line:


Cause:

This is due to some error in BITS transfer from the DP to the client cache.

Resolution:

1.     First disable BITS on the DP from where the client is downloading the content (you can get this from datatransferservice.log).


2.     Wait for 10 minutes for changes to take effect.
3.     Reset the policies on the client (use SCCM Client Center->Policy Reset (Hard-Reset)).
Delete the cache folder for that advertisement.
5.     Request the Machine Policy.
6.     Rerun the Advertisment.
7.     Check the execmgr.log for success.
8.     To rerun the Advertisement on ALL the failed computers, create a new Program with same settings and rerun the Advertisement,