Dynamic Group population and Role based Access PowerShell

For a customer i created a script which create new groups for all kind of unique jobtitles available in Active Directory. After the creation of all groups it loops through all users and add these to the created groups in the function above. This scripts help you to maintain for example role base access.

This scripts contains 3 functions:
1. Creating groups for all the unique jobtitle’s available.
2. Adding users with the same Jobtitle
3. Remove users after jobtitle change

 

 

ID: 2912 | Details: Service unavailable (503) (0x801901F7) | NO_PARAM NO_PARAM

During the deployment of a new resource or adding a new resource  there is a possibility that you can face the following error:

An internal error has occurred trying to contact the ” server: NO_PARAM: NO_PARAM.
WinRM: URL: [http://:5985], Verb: [INVOKE], Method: [GetError], Resource: [http://schemas.microsoft.com/wbem/wsman/1/wmi/root/microsoft/bits/BitsClientJob?JobId={1FAA84D0-C551-4410-AB54-0DE094840D37}]

Service unavailable (503) (0x801901F7)

Recommended Action

Check that WS-Management service is installed and running on server ”. For more information use the command “winrm helpmsg hresult”. If ” is a host/library/update server or a PXE server role then ensure that VMM agent is installed and running. Refer to http://support.microsoft.com/kb/2742275 for more details.

After some investigation this can happen due two circumstances:

1.The VMM Certificate has expired. Check this one in your certificate store.

If the certificate is expired, create a new one:

Then, refresh all VMM Infrastructure servers (including VMHosts) so they get the new certificate.

2.The port is used by another program.

After installing the newest product from Microsoft “Admin Center” on our Library server we faced the same issue.

To solve this: Go to the library server -> Open regedit -> Search for “BITSTcpPort” -> Change the value to an unused Port like (8500).
Restart the SCVMM Agent and refresh your Library share in SCVMM.

No mapping between account names and security IDs was done.

Last day’s very busy with a small DevOps project in our company. Automating “bare metal deployment” of new Hyper-V Servers. We deploy the software with a combination of MDT and the brand new HP (finally) PowerShell commands.

During the step of renaming and joining the new server we faced the following error:
Computer failed to join domain ” from its current workgroup ‘WORKGROUP’ with following error message: No mapping between account names and security IDs was done.

After some troubleshooting we found a solution, by adding the two options: JoinWithNewName and AccountCreate
Renaming computer PowerShell and Joining a domain with PowerShell

 

Converting a VMWare CentOS VM to Hyper-v

After converting the VMDK I faced the issue that the VM Won’t boot without preinstalled Hyper-V drivers.
Fixed this with regenerate the Initrd BEFORE converting to Hyper-v (VHDX).

 

 

Windows 10 Start menu search is not working

I had the annoying issue that my Windows 10 Search bar stops working for some reason. Trying to restart the services, restart Windows and kill the Cortana processes doesn’t work in my situation. After a lot of searching, I’ve found the solution in some forum.

The solution: Re-register Cortana with PowerShell.
Run PowerShell as administrator and past the following line:

 

 

Remove Hyper-v node from SCVMM Failed: Error(25333)

In some situations (hardware failures etc.) it’s not possible to remove the Hyper-v cluster node nicely out of SCVMM. When removing the Hyper-v node from VMM it will throw an Error (25333) in SCVMM. This is because the server is down and it’s not possible to remove the SCVMM Host agent.

To solve this you can use the following PowerShell command:

 

Enable safe mode Windows 8 or 10

Last week I was working on a young defect SSD powered computer running on Windows 10. Hitting the F8 key for enable the save mode while booting was almost impossible. Don’t know if the key is disabled or Microsoft reduced the time periods for pressing F8 near 0 seconds.

Enable safe mode Windows 8 or 10 with MSCONFIG

Go to your command prompt (CMD) or search for the executable called “run” and type MSCONFIG and hit enter. Switch to the boot tab and select the button “safe boot”, then reboot.

 

Enable F8 key Windows 8 or 10

To enable the F8 key. Run the command prompt (CMD) as administrator. Search for RUN or directly CMD -> right click -> Run as administrator.  And copy the following lines into the prompt and hit enter. Reboot needed:

Change back to the default settings:

 

Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available

Yesterday I was facing this error when running a SMA Runbook with the invoke-webrequest cmdlet. For troubleshooting I had to enable SMA script logging for this runbook so I was able to see wats going wrong. The error says you must run the “getting started setup” of internet explorer for the service account which is running the scripts.

 

This is not ideally when you run this script on multiple servers. Now there are 2 options available to ignore this stupid error:

1. Enable the Group policy object (GPO) for Prevent running first run wizard. This setting is in “Computer configuration -> Policies -> Administrative templates -> Windows Components -> Internet Explorer”. Set the “Prevent running first run wizard” to enabled.

2. Run the Invoke-webrequest with the –UseBasicParsing CMDlet.

 

 

VEEAM Task failed Error: Exception of type ‘System.OutOfMemoryException’ was thrown

Last week I had the following error when starting a Veeam backup job. I thought my proxy servers where out of memory, so I rebooted them. Then I started the backup jobs again, with no result.

Solution:
To solve this issue you must logoff all the other RDP sessions, which have a disconnected session with the Veeam console open. Alternatively, give the Veeam backup server more resources so there is more memory available.

PowerShell: The specified string is not in the form required for a subject

During the creation of a PowerShell SMA Runbook I was getting the following error message. This error appear when sending an automatic mail message with the send-mailmessage cmdlet. It only happens when the subject is filled with a String parameter which contains invalid characters.

After two hours of troubleshooting I formatted the string with the following regex which worked in my case: