How to Migrate DHCP Scopes from Windows 2008/Windows 2012 to Windows 2019 Server using PowerShell

This is tricky and sometime GUI backup and restore may give you errors like function not supported or cannot import the DataBase.

Using this powershell method, there is no error and using verbose logging you can also see the logs at the same time.

Use below PowrShell to export the scopes from old server to new server.

Export-DhcpServer -File C:\temp\DHCPDB.xml -Leases -Force -ComputerName fra-winapp01.prg.ori.local –Verbose

then move the XML file exported at the c:\temp to new dhcp server.

Then run the below command to import the dhcp scopes to new server.

Import-DhcpServer -File C:\temp\DHCPDB.xml -BackupPath C:\temp\ -Leases -ScopeOverwrite -Force -ComputerName dhcpprg1.prg.ori.local –Verbose

[Solved] Error: The Windows Module Installer must be updated before you can install this package. Please update the Windows Modules installer on your computer, then retry setup

 While installing patches manually on 2008 R2 servers Getting message as

The Windows Modules Installer must be updated before you can install this package.
Please update the windows modules installer on your computer, then retry setup.

We have downloaded MSU installer from below MS link and try to install the KB2533552 on the server but not installing Getting message as " The update is not applicable to your computer&amp

Solution:-

These patches need to be installed in order below.

2020 – 07 : Service Pack Stack Update (KB4565354), then

2020 – 07 : Rollup (KB4565524) or 2020 – 07 Security only (KB4565539)

An authentication error occurred. The function requested is not supported. This could be due to CredSSP encryption oracle remediation.

1. INTRODUCTION

A remote code execution vulnerability exists in the Credential Security Support Provider protocol (CredSSP). An attacker who successfully exploited this vulnerability could relay user credentials and use them to execute code on the target system.

CredSSP is an authentication provider that processes authentication requests for other applications; any application which depends on CredSSP for authentication may be vulnerable to this type of attack.

As an example of how an attacker could exploit this vulnerability against the Remote Desktop Protocol, the attacker would need to run a specially crafted application and perform a man-in-the-middle attack against a Remote Desktop Protocol session. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights.

The security update addresses the vulnerability by correcting how Credential Security Support Provider protocol (CredSSP) validates requests during the authentication process.

2. RDP SESSION

An update released by Microsoft (KB 4093492)on May 8, 2018, for Windows 10 Operation System was targeted to change the default settings CredSSP from Vulnerable to Mitigated.

However, post patching this caused an issue where the patched clients were blocked from communicating with unpatched servers over RDP protocols.

This has been reported to cause an error thrown by Windows RDP as below:

3. WORKAROUND

Use the group policy settings changes described below to rollback the changes to ‘Vulnerable’ state to allow RDP access.

1. Open Group Policy Editor, by executing gpedit.msc

2. Policy path: Computer Configuration -> Administrative Templates -> System -> Credentials DelegationRun gpedit.msc and expand Administrative Templates

Expand System

Expand Credential Delegation

Edit Encryption Oracle Remediation

Select Enabled and change Production Level to Vulnerable

3. Run the command gpupdate /force to apply group policy settings.

4. Your remote desktop connection will be working fine now.

CONCLUSION

This is just a workaround and defeats the purpose of the patching. However, we need to ensure that future updates are installed as and when released by Microsoft so that the vulnerability is not exposed.

How to Schedule PowerShell Script using Task Scheduler

Method 1: Schedule PowerShell Script using Task Scheduler

Open Task Scheduler from Administrative tools.

To run a script from Task Scheduler, follow these steps.

1.Open Task scheduler –> Task Scheduler Library –> Create Task

2.In General tab, you can set scheduler name and description about the task like for what purpose the task has created.

Available security options explained below.

  • Specify the user on whose behalf the task will be run.
  • You can specify that a task should run . It can be done by selecting a radio button labelled ‘Run Whether the user is logged on not’. If this radio button selected, the task will not run interactively. To make a task run interactively, select the ’Run only when user is logged on’ radio button.
  • When the ‘Run whether user is logged on or not’ is selected, you may prompt to supply the credentials of the account, regardless of whether you select the checkbox ‘Do not store password’ or not. If the account is not logged on during task execution, saved credentials will be used.
  • If the task requires elevated privileges, then select the option ‘Run with highest privileges.’

3.Switch to the Trigger tab and click the New button. Here, you can set conditions that trigger a task.

  • You can specify when to start the task. For example, you can have it executed on a schedule, at start-up, at logon or whenever a particular event occurs by selecting ‘Begin the task’ drop-down menu.

  • You can configure whether you want to run this task once or daily or weekly or monthly according to your scenario.
  • In the “Advanced settings”, you can choose to delay task, repeat task, stop task if it runs longer than the specified time period and expiry date.
    • Delay task for up to – This adds a random delay, so the task won’t stat at the exact time of the day.
    • Repeat task every – It shows the number of times a task should run after a trigger is fired.
      • Repeat task every – Time interval between each task repetition
      • For a duration of- How long a task should continue to repeat
    • Stop task if it runs longer than- If the task runs longer than the expected time or never quit, task will automatically stop if it reaches the mentioned time limit.
    • Expire – After the time period specified, the schedule won’t be triggered.

4.Then open the next tab ‘Actions’ and click the ‘New’ button.

  • In the Action drop-down, “Start a program” is set by default. You can change it if required.
  • Using Browse, select program/script field. To schedule a script, we need to select powershell.exe.
    You can find powershell.exe in your system32\WindowsPowerShell\v1.0 folder.
  • In ‘Add arguments’, -File parameter is the default one so simply specify the script path. For example, I am going to schedule a script that exports Office 365 users MFA status report.

1

c:\GetMFAStatus.ps1

If the path contains any blank space, it should be enclosed with quotes.

5.Once configured, you can specify conditions to determine whether the task should run. The task will not run if any condition specified here is not true.

6.On the Settings tab, you can set additional advanced settings to control the task execution.

Finally, click Ok to create a scheduled script.

Scheduled script will run as expected according to your schedule without any issue. If you want to check script execution, you can click Run by right-clicking task name.

Automate PowerShell Script from Task Scheduler with Parameters

If you want to schedule the PowerShell script with parameters, use the below format.

1

Script path -Param 1 Value1 -Param2 “Value 2”

For example, I am going to automate one of our PowerShell script: Export Office 365 Users MFA status report

During schedule, you can explicitly pass the credential as parameters as shown below:

1

C:\GetMFAStatus.ps1 -UserName “XXX XX” -Password ****

If the parameter value has blank space, values should be enclosed with quotes.

If you want to pass a switch parameter, you can use below syntax.

1

C:\GetMFAStatus.ps1 -EnabledOnly

Above script exports Office 365 users MFA status whose MFA status is enabled. Here -EnabledOnly is a switch parameter.

For more Office 365 related PowerShell scripts, you can refer O365Reports.com blog.

Method 2: Schedule PowerShell Script from Task Scheduler Using PowerShell

Instead of GUI, you can use PowerShell cmdlets to create schedule task that automate PowerShell script. It involves following steps,

1.Define time for scheduler

2.Set Actions to be performed during execution

3.Save scheduler

Define Time for Scheduler:

New-SchdeuledTaskTrigger creates a scheduled task trigger object. Using this cmdlet, you can specify starting time of a task or starting a task multiple times on a daily or weekly basis.

1

$Time=New-ScheduledTaskTrigger -At 4.00PM -Once

Above cmd creates a scheduled task trigger that starts at 4PM and run once.

1

$Time=New-ScheduledTaskTrigger -At 4.00PM -Daily -DaysInterval 2

Above cmd creates a scheduled task trigger that starts every 2 days at 4PM

Set Actions to be Performed During Execution:

New-SchdeuledTaskAction represent actions that executed when Task Scheduler runs the task. A task can have single action or a maximum of 32 actions. When you specify multiple actions, task Scheduler executes a task sequentially.

1

$Action=New-ScheduledTaskAction -Execute PowerShell.exe -WorkingDirectory C:/Scripts -Argument “C:\Scripts\MFAStatus.ps1 -UserName XXXX -Password ��

This command opens a PowerShell and change the directory to C:/Scripts and then invoke the MFAStatus.ps1 script.

Save Scheduler:

Register-ScheduledTask saves the scheduled task on a local computer.

1

Register-ScheduledTask -TaskName “Schedule MFA Status Report” -Trigger $Time -Action $Action -RunLevel Highest

The above cmd saves a scheduled task with a name “Schedule MFA Status Report” in the root folder. The saved task uses the pre-created action and trigger values that are specified by $Action and $Time variables.

20 Dos and don’ts to prevent corona virus from spreading

1- Do: Avoid large crowds. The best way to slow the spread of the virus and protect those at risk of serious illness is social distancing, according to the Centres for Disease Control and Prevention. That means it’s important to avoid crowded spaces, community gatherings and other events that could speed up the spread of the virus.

3- Don’t: Hoard paper and hygiene products so that there’s none left. “Panic buying is a self-fulfilling prophecy,” Karan Girotra, professor of operations at Cornell University, told USA Today. “If everyone thinks things are going to run out, they go and buy out things and they do run out.”

3- Do: Call your doctor if you’re displaying symptoms of the illness. Fever, cough and shortness of breath are the most common symptoms of the coronavirus known as COVID-19.

4- Don’t: Panic. The CDC still considers the general public’s risk as “low.” But seniors and those with compromised immune symptoms face a higher risk of serious illness, so it’s important to follow the CDC and local officials’ instructions. It’s unlikely that the virus is transmitted through food or sex, so there’s little reason to worry about either of those things.

5- Do: Care for your pets like normal. It’s highly unlikely that dogs and cats can pass coronavirus to people, the Associated Press recently reported. Experts from two universities in Hong Kong and the World Organisation for Animal Health agreed that “human-to-animal” transmission would be more common, but only low-levels of infection have been reported so far.

6- Don’t: Kiss your dog or cat. Although the risk of catching the infection is low, Hong Kong’s Agriculture, Fisheries and Conservation Department still suggest pet owners not kiss their cat or dog for the sake of good hygiene, the Associated Press recently reported.

7- Do: Wash your hands for at least 20 seconds. According to the Centers for Disease Control and Prevention, the best defense against the virus is washing your hands with soap and water for at least 20 seconds before eating, after using the bathroom and after blowing your nose, coughing or sneezing.

8- Don’t: Touch your face. Coronavirus begins in the eyes, nose or mouth, The Washington Post recently reported. The more you touch your face, the more you increase your risk of exposure to the virus.

 

9- Do: Use hand sanitizer when soap and water isn’t available. The CDC recommends that the hand sanitizer contain at least 60% alcohol.

10- Don’t: Leave used tissues on the couch, nightstand or anywhere but a garbage can. The virus is spread through respiratory droplets that can survive on hard surfaces.

11- Do: Regularly clean hard surfaces, including TV remotes, cellphones, light switches and doorknobs. The CDC recommends wearing gloves and only using disinfectants registered with the Environmental Protection Agency, which recently released a list of products that kill coronavirus from surfaces.

12- Don’t: Leave your purse on the ground. A 2013 study from Initial Washroom Hygiene, a UK-based hygiene and washroom services company, showed that handbags have more bacteria than a toilet seat. Putting your purse on the ground of a public restroom or the floor of a bus increases your exposure to not only bacteria but also viruses.

13- Do: Wear a face mask if you’re a health care provider or caregiver. The World Health Organization recommends washing your hands frequently, avoiding touching your face or the mask and throwing them away in a closed garbage bin.

14- Don’t: Buy face masks if you’re not in the health care industry. Not only could a mask shortage be detrimental to health care professionals but also masks could increase residents’ chance of infection because they’re often worn improperly.

15- Do: Be careful while continuing to use public transportation. Several agencies, including SMART and San Francisco’s BART, are cleaning and disinfecting their trains more frequently to prevent the virus from spreading. Other safety measures include standing or sitting away from others, limiting contact with train and bus poles, carrying hand sanitizer, keeping your purse off the ground and avoiding eating, drinking or using your phone, according to Business Insider.

16- Don’t: Use Lyft, Uber or public transportation if you’re showing symptoms of coronavirus, which includes coughing, difficulty breathing and fever, to prevent the virus from spreading.

17- Do: Choose a window seat if you’re traveling on an airplane. You’re the least likely to come into contact with someone affected by any virus, according to National Geographic, although washing your hands and avoiding coughing passengers also is recommended.

18- Don’t: Travel to China, South Korea, Italy and Iran unless absolutely necessary. The CDC issued a Level 3 warning, the most extreme included in its guidelines, for US residents to avoid all nonessential travel to these countries because of the virus

19- Do: Be cautious, but continue to support local restaurants. The wine and beverage industry may take a hit from the coronavirus. Because the CDC is urging people across the country to distance themselves from others and avoid crowded places, the best way to support local restaurants is buying gift cards or ordering takeout. The New York Times recently reported that food likely cannot carry the coronavirus, but it’s important to be mindful of menus and serving utensils that others may have touched.

20- Do: Have two weeks of groceries on hand in case you’re quarantined for two weeks. Dry goods such as rice, pasta, beans and oats, along with canned goods such as tomatoes and beans, are recommended, according to Business Insider. Other items include pet food, prescriptions and diapers if you have children.

PowerShell Install-Module: The term ‘Install-Module’ is not recognized

PowerShell error : Install-Module: The term ‘Install-Module’ is not recognized as the name of a cmdlet.
This error Is Manly Because Of The Limitation of cmdlet and resource available on Machine.

This Gallery TechNet Will help you to resolve The Error” Install-Module: The term ‘Install-Module’ is not recognized as the name of a cmdlet.”
While Performing This Step We Need to restart the system So Request You to Save Any unsaved Document Before Following the Below Steps.
To Resolve This We Need to Update. Windows Management Framework 5.1 with the Help of Below Link

https://www.microsoft.com/en-us/download/details.aspx?id=54616
*Tested on Client Machine

Step 1 : Run the PowerShell as Administrator.

 

Step 2 : When We try the Command Install-Module msonline
PS C:\Users\Administrator>Install-Module msonline
It Givens Error
Install-Module : The term ‘Install-Module’ is not recognized as the name of a cmdlet, function, script file,or operable program.
Check the spelling of the name, or if a path was included,verify that the path is correct and try again.
At line:1 char :1
+Install-module msonline



Step 3 : To Check the Host version Type Host

PS C:\Users\Administrator>HOST

 

Step 4 :if the Host Version 4.0 or Below That Need to Download And Install the Windows Management Framework 5.1

Need to Update. Windows Management Framework 5.1 with the Help of Below Link

https://www.microsoft.com/en-us/download/details.aspx?id=54616
* Note :When We Download and install windows Management Framework 5.1. it Will restart the Machine So please Save any unsaved Document.


Step 5 : Choose the Download you want as per Your Operating System.

Step 6 : Once we Restart the Machine Than Run the PowerShell as Administrator again.

Step 7 : We can Confirm if the HOST Version is Updated to 5.1

Component-Based Servicing (cbs.log) causes all drive space to be consumed

Because I’ve seen this question asked in many places and not answered, I thought I’d post my issue and resolution here.  I regard this as a Bug, but I’m not invested enough to deal with the support incident process.

I’ve had repeated instances where a Windows 7 x64 client runs out of hard drive space, and found that C:\Windows\TEMP is being consumed with hundreds of files with names following the pattern “cab_XXXX_X”, generally 100 MB each, and these files are constantly generated until the system runs out of space.  Upon removing the files & rebooting, the files start being generated again.

I’ve found that this is caused by large Component-Based Servicing logs.  These are stored at C:\Windows\Logs\CBS.  The current log file is named “cbs.log”.  When “cbs.log” reaches a certain size, a cleanup process renames the log to “CbsPersist_YYYYMMDDHHMMSS.log” and then attempts to compress it into a .cab file.

However, when the cbs.log reaches a size of 2 GB before that cleanup process compresses it, the file is to large to be handled by the makecab.exe utility.  The log file is renamed to CbsPersist_date_time.log, but when the makecab process attempts to compress it the process fails (but only after consuming some 100 MB under \Windows\Temp).  After this, the cleanup process runs repeatedly (approx every 20 minutes in my experience).  The process fails every time, and also consumes a new ~ 100 MB in \Windows\Temp before dying.  This is repeated until the system runs out of drive space.

This can be reproduced by trying to manually create the cab file –

Directory of C:\CBS-BAK
12/11/2019  12:28 PM    <DIR>          .
12/11/2019  12:28 PM    <DIR>          ..
12/11/2019  12:12 PM     2,491,665,966 CbsPersist_20150823021618.log

C:\CBS-BAK>makecab CbsPersist_20150823021618.log
Cabinet Maker – Lossless Data Compression Tool
86.19% – CbsPersist_20150823021618.log (1 of 1)
ERROR: (FCIAddFile)Data-size or file-count exceeded CAB format limits

C:\CBS-BAK>dir %TEMP%\cab*
Volume in drive C is OSDisk
Volume Serial Number is 44DE-0CDD
Directory of C:\Users\USERNAME\AppData\Local\Temp
08/26/2015  02:31 PM       102,786,654 cab_4556_2

12/11/2019  12:28 PM        12,978,919 cab_5860_2
12/11/2019  12:27 PM                 0 cab_5860_3

To resolve this –

Stop the Windows Modules Installer (TrustedInstaller) service

Delete or move the large Cbspersist_XX.log file out of \Windows\Logs\CBS.

Start the Windows Modules Installer (TrustedInstaller) service

How to Disable/Enable Internet Options Tabs in Internet Explorer

As an IT guy, I always encounter problems when untrained users tweak their Internet connection settings.  They always make a mistake somewhere and sometimes the solution is to just keep them away from the Internet Options dialog box altogether.

I have worked at many companies that hide the Internet Options tab in Internet Explorer to discourage users from changing the options, which makes sense since network admins are the only ones who are supposed to access these options.

In a controlled environment, companies usually allow only one type of browser like Internet Explorer and those companies usually don’t allow their employees to change the Internet Options like default the homepage and proxy server.

Below is a typical Internet Options window:

clip_image001

There are several ways to disable the Internet Options tabs in IE and I’ll explain the different methods in this post. The first method uses Group Policy, but will only work if you have the Pro or Ultimate versions of Windows. If you are running Home or Home Premium, then skip down to the registry section.

Disable Internet Options in IE via Group Policy

To disable any tab in the Internet Options window, follow these steps below:

Step 1: Click Start and type GPEDIT.MSC in the search bar and hit enter to launch the Group Policy editor window.

clip_image002

Step 2: In the Local Group Policy editor window expand User Configuration > Administrative Templates > Windows Components > Internet Explorer then click on Internet Control Panel.

clip_image004

Step 3: On the right pane of the window, double click on the item you want to disable. For example, to disable the Advanced tab, double click on Disable the Advanced page option.

clip_image006

Step 4: In the properties window, click on the Enabled option and click OK. The Advanced tab in the Internet Options window will now be disabled and removed.

clip_image007

Step 5: Follow the previous steps to disable other items in the Internet Options window. To enable items, just select the Not Configured option in the properties window and click OK.

There you have it!  For less savvy computer users who don’t know about GPEDIT, it should discourage them from changing the advanced settings in IE.

Disable IE Options via Registry Editor

The second way to disable tabs in IE options is to use the registry editor. This is a bit more complicated, but is the only option if you can’t access group policy editor.

You can open the registry editor by clicking on Start and typing in regedit. Once there, navigate to the following key:

HKEY_CURRENT_USER\Software\Policies\Microsoft

Note that if you want to disable this option for all users on the PC, navigate to the same key, but under HKEY_LOCAL_MACHINE.

If there isn’t already a key called Internet Explorer under Microsoft, you’ll have to create it manually. Just right-click on Microsoft and choose NewKey. At this point, there are two options. If you want to disable the entire Internet Options dialog, you can create another key under Internet Explorer called Restrictions.

clip_image009

Lastly, you’ll create a new DWORD value in the right-pane inside Restrictions called NoBrowserOptions. Give that a value of 1 and restart Internet Explorer. If you try to go to Internet Options, it will give you an error message.

clip_image010

If you don’t want to disable the whole dialog, but instead just a few of the tabs, then you should create a new key called Control Panel under Microsoft instead of Restrictions. Inside of that, you’ll create DWORD entries that correspond to the tabs:

AdvancedTab

ConnectionsTab

ContentTab

GeneralTab

PrivacyTab

ProgramsTab

SecurityTab

clip_image012

As you can see above, I created the Control Panel key under Internet Explorer and then created a DWORD entry in the right-pane called AdvancedTab with a decimal value of 1. This removed just the advanced tab from the IE options window.

Hopefully, these methods will allow you to gain more control over Internet Explorer advanced settings in your environment. If you’re having issues, feel free to comment and I’ll try to help. Enjoy!