DPM 2012 Suspect Tape

Hi Guys,

Yesterday, when I had to restore some data for the user it failed. I was sure that I have all the necessary tapes. When I checked library I noticed that one of the tapes has suspect status.

After short searching for a solution, I found out that I have to change status in SQL.

osql -E -S DB_Server_Name -d DPM_DB_NAME -Q "UPDATE tbl_MM_ArchiveMedia SET IsSuspect = 0"

You can run this command from the DB server or DPM. It will change all affected records.

Easy way to fix “The trust relationship between this workstation and the primary domain failed”

This happens very often. Usually I was rejoining workstation/server to the domain. However it is easier way to do it.

  1. You have to log in to the server with a broken relationship.
  2. You have to know the name of Domain Controller (example: AD01)
$DomainCred = Get-Credential
Reset-ComputerMachinePassword -Server "AD01" -Credential $DomainCred

That’s all.

How to kill frozen service

Hi Guys,

This happens very often that you are going to services.msc and you want to restart service and after a few seconds, you see that service is hung (grey out).

Step1. Grab the name of the service.

Step2. Get PID of the service.
sc queryex servername

looking for PID

Step3. Kill the PID
taskkill /f /pid [PID]

That’s all, now you can start service in service console.

How to find SID users/groups/computers star from pa*

I had to get SID for all Users that Logon Name begin with pa

Get-ADUser -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

For all Groups that Name begin with pa

Get-ADGroup -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

For all Computers that Name begin with pa

Get-ADComputer -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

Getting VHD size plus info using PowerShell for the all Virtual Machines on the cluster

Hi Guys,

This is was not a simple task… because of Get-VMHardDiskDrive can’t give you the size of the drive.

$VMget=Get-VM -ComputerName (Get-ClusterNode -Cluster ClusterName) | Get-VMHardDiskDrive | Select-Object -Property vmname, vmid, computername, controllertype, controllernumber,controllerlocation,path
foreach ($VM in $VMget) {
$VHDRemotePath=$VM.Path -replace ":", "$"
$vhdsize= Get-ChildItem $VHDRemotePath | select-object @{Name="SizeGB";Expression={"{0:N2}" -f ($_.length / 1GB)}}
$text = $VM.VMName + " , " + $vhdsize.SizeGB + "GB , " + $VM.Path
$text | out-file C:\Temp\VHD_Size.csv -Append

It exports to CSV however you still have to use “Text to Columns” in Excel.

Enjoy 🙂

How to fix broken group policy object or Direct Access

Hi Guys,

Some of my users are able to break Direct Access and when they run gpupdate /force they are getting

“The processing of Group Policy failed. Windows could not apply the registry-based policy settings for the Group Policy object LocalGPO. Group Policy settings will not be resolved until this event is resolved. View the event details for more information on the file name and path that caused the failure.”

To fix it:
Go to the: C:\Windows\System32\GroupPolicy (This folder is hidden)
Go to the machine folder: rename registry.pol to registry.bak
Run gpupdate /force
Restart computer.

That’s all.

How to export all mailboxes to PST file on Exchange.

Hi this is my easy way to export all mailboxes to PST on the Exchange servers.

Step1: We have to give our user permission to EXPORT mailboxes.

New-ManagementRoleAssignment -role "Mailbox Import Export" -User OUR_USER

Step2: Please create folder where you want to save PST files.

Step3: Export user names.

Get-mailbox| Select-Object -ExpandProperty Name | Out-File -FilePath "c:\user_list.txt"

Step4: Run script bellow. Please remember to change path where you want save PST files. Very important it has to be UNC path.
foreach ($user in $content)
New-MailboxExportRequest -Mailbox $user -FilePath "\\MY-Server\PST\$user Mailbox.pst"