Saturday 25 June 2016

SCCM

(1)
To find all windows 7 machines in your environment you can use the following query.

select SMS_R_System.NetbiosName,
SMS_R_System.OperatingSystemNameandVersion from 
SMS_R_System where
SMS_R_System.OperatingSystemNameandVersion like "%Workstation 6.1%"
(2)
To find all windows 10 machines in your environment you can use the following query.

select SMS_R_System.NetbiosName,
SMS_R_System.OperatingSystemNameandVersion from 
SMS_R_System where
SMS_R_System.OperatingSystemNameandVersion like "%Workstation 10%"
(3)
To restart a remote computer Remotely

shutdown /m \\computername /s
(4)
Clients are unable to get updates from SCCM 2012,
getting error: "Job error (0x87d00692) received for assignment"
To resolve this issue check the assigned WSUS server, in my case a GPO was applied in which another WSUS was mentioned. after disabling that GPO on client machines, machines were able to get updates.

you can check the assigned WSUS by checking in the following registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate

(5)
To check the status of Update deployment you should check the log file "UpdateDeployment " at location "C:\windows\CCM\Logs" on client.
(6)
To show list of installed updates with power shell command:
Get-HotFix | Sort-Object InstalledOn -Descending
7)
To install SCCM client on workgroup computers
ccmsetup.exe smssitecode=abc smsmp=mp.domain.com
To check the current assigned WSUS server to your client machine. go to the following location on client Machine. Start-->run-->gpedit.msc-->local computer policy-->computer configuration-->Administrative templates-->Windows Compunents-->Widows update. then look into "specify intranet Microsoft update service location" here you will see the server and port like "http://SCCM.domain.com:8530"

Wednesday 22 June 2016

How to restore a deleted object in active directory 2008 R2 and Activie Directory 2016 and Exchange Server

If you have deleted any AD object unexpectedly and want to restore it. If you have already enabled the ADRecycleBin then you can do it with the following steps.

First let's check if your recycle bin is enabled or not.
you can check with the following command
Get-ADOptionalFeature -Identity 'Recycle Bin Feature'

The above command will show the complete detail of recycle bin.

Let's it was enabled then you can use the following command to first find the deleted object.
you can use the following to display the deleted object first.
Get-ADObject -Filter {displayName -eq "DisplayNameOfUser"} -IncludeDeletedObjects
or
Get-ADObject -Filter {samaccountname -eq "nawaz.nawaz"} -IncludeDeletedObjects

Now it should show the deleted object to you.
let's you have found the deleted object and now want to restore.

you can use the following command to restore that ID.

Get-ADObject -Filter {displayName -eq "DisplayNameOfUser"} -IncludeDeletedObjects | Restore-ADObject


Note: you may need to add the target path as well in AD 2016, so you may use the following command.

Get-ADObject -Filter {UserPrincipalName -eq "nawaz@domain.com"} -IncludeDeletedObjects | Restore-ADObject -TargetPath "OU=Users,OU=HR,OU=Managementname,DC=domain,DC=com"

Note: if this AD Object/ID have any mailbox then that will be automatically recovered with out any issue. just wait for few minutes.
P.S: Will be better if just copy/past the displayname of the user object to be restored. As it is case sensitive. and the result would not display if you typed lower character instead of upper character.