PowerShell: Retrieve session information from Internet and create .ICS File

Really looking forward in attending ExpertsLive Europe by the end of this month and I was looking at the sessions and was wondering how to send them to my agenda.

Since typing is no option I decided to use PowerShell to automate this process 🙂

For the script and ICS file to directly import – https://gallery.technet.microsoft.com/scriptcenter/Retrieve-session-3f43ec1f

The Idea

Read the session information from the experstlive site using PowerShell.

Gather the session information and create appointments in my agenda.

Solution

The steps sounds pretty easy but  as always when time goes along it is not that easy 😉

First I needed to query the data from the website.

I tried using the invoke-webrequest.

First you need to tell PowerShell to use TLS 1.2 (by default it uses 1.0 which fails)

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

After trying many options I couldn’t retrieve the information I wanted. So I started to look at other options.

The option which worked for me was starting IE and gather the information from there:
$global:ie=new-object -com "internetexplorer.application"
$ie.visible=$true
$ie.navigate("https://www.expertslive.eu/sessions--call-for-speakers.html")

This part opens IE and navigates to the correct website.

After opening the website we need to make sure the website is fully loaded:

while ($ie.readystate -lt 4){start-sleep -milliseconds 200}

When the website is fully loaded we can retrieve the sessions:

$Sessions = $ie.Document.getElementsByTagName("li") |Where-Object {$_.className -eq "sz-session sz-session--full"}
When we look at our array we can see the information is in there.

 

Next I gathered the information and alter to remove the trailing spaces, hard enters etc.

After this I created an ICS file and imported the information.

This caused some time to find the correct format. Also I needed to change the times to the correct format and set them back to UTC. Otherwise the import would edit the times again…

Although I would have loved to simply automatically import the ICS into my outlook agenda….this failed.

Reason is this is not possible…or it will add an extra agenda…

Only option is to manually import the ICS file:

Import/Export

When selecting the file it will prompt you to import in default agenda or creating a new agenda.

After importing in my default agenda:

 

 

Ony thing left is removing the sessions you will not attend or leave it as is

 

 

Geplaatst in Uncategorized | Een reactie plaatsen

.Net framework remote offline installation using wusa and PowerShell

Problem

The offline installer (.exe) will extract and try to use WUSA to install .Net Framework. This will fail and if you check the installation log you will see an access denied message.

This is because Wusa.exe is not allowed to run remote as described in http://www.owl-it.nl/uncategorized/powershell-remote-wusa-exe-not-working-access-denied/

This article provides a work around using wusa to extract (which is allowed) and using dism to install the cab files.

Now if you want to install .Net Framework remote using PowerShell using the offline installer you run into the same problems.

The offline installer (.exe) will extract and try to use WUSA to install .Net Framework. This will fail and if you check the installation log you will see an access denied message.

Solution

The solution installing .Net Framework remote using PowerShell is to create a scheduled task to start the offline installer (.exe).

Although this sounds easy there are some things to take into consideration.

You will get the below error message when you want to create the task and set to delete afterwards all in one go.


register-ScheduledTask : The task XML is missing a required element or
attribute. (49,4):EndBoundary:
At E:\ARUN\TestScript\AutomateScheduledTask.ps1:33 char:4
+    Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041319,Register-ScheduledTask

This is a bug :

https://stackoverflow.com/questions/29337135/powershell-v4-create-remote-task-scheduler-task-set-to-expire-and-delete

https://stackoverflow.com/questions/50974448/error-creating-scheduled-task

Work Around

The idea is to schedule the task 10 seconds from now, run the task and once finished delete it again.

First create the task :


$exe = "C:\temp\NDP452-KB2901907-x86-x64-AllOS-ENU.exe"
$action = New-ScheduledTaskAction -Execute $exe -Argument "/q /Norestart"
$trigger = New-ScheduledTaskTrigger -Once -At (get-date).AddSeconds(10)
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8
Register-ScheduledTask -TaskName ".Net Framework Installation Task" -Force -User System -Action $Action -Trigger $Trigger -Settings $Settings

After the task creation we need to edit the task again, this is because the bug.


$task = (Get-ScheduledTask -TaskName "Install452")
$task.triggers[0].EndBoundary = (get-date).AddSeconds(60).ToString('s')
$task.Settings.DeleteExpiredTaskAfter = "PT0S"
Set-ScheduledTask -InputObject $task

Geplaatst in Uncategorized | Een reactie plaatsen

PowerShell Remote WUSA.exe Not working / access denied

When you require installation of MSU files the local solution using wusa.exe to install the patches / hotfixes will work like a charm running it locally.

Example on installation windows management framework 5.1:

wusa 'C:\Install\Win8.1AndW2K12R2-KB3191564-x64.msu' /quiet /norestart |wait-process

or using start-process

start-process -FilePath 'wusa.exe' -ArgumentList "C:\Install\Win8.1AndW2K12R2-KB3191564-x64.msu /norestart" -wait

Both solutions will install the MSU locally using Wusa.exe.

If you want to remotely install these MSU files using PowerShell ie. invoke-command. You will get an access denied message.

The reason for this is wusa.exe is not allowed to run remote!!

You can though extract the files using wusa.exe and after extraction install them using dism.exe.

 

https://support.microsoft.com/en-us/help/2773898/windows-update-standalone-installer-wusa-returns-0x5-error-access-deni

Geplaatst in Uncategorized | Een reactie plaatsen

Installing System Center 2016 eval with SQL 2016 running in Windows server 2016 eval

First of all I installed a brand new windows server 2016 and promoted it to a DC.

My second server will be a Database server, I always install a separate SQL server dedicated for System Center.

Since I don’t have tons of memory this will give me the best performance results , granting the Database server with enough memory.

SQL 2016 installation.

Just run the setup as you are used to do and install the correct database components for SCOM.

A nice added feature during installation is you can now configure your temp db’s during setup ! Smile

 

image

For reference on tempdb configuration – https://technet.microsoft.com/en-us/library/ms175527(v=sql.105).aspx

 

After installation there is one more thing, the SQL Server Management tools are no longer in the setup.

image

You need to download the tools and install them separately.

For more information on SQL Server Management Tools 2016 and download link – https://msdn.microsoft.com/library/mt238290.aspx

And the new features – https://www.mssqltips.com/sqlservertip/3683/new-features-in-sql-server-management-studio-for-sql-server-2016/

image

The installation:

image image

 

Setup of SQL server 2016, .net framework 3.5 dependency …finally gone ! Smile (so yes! it can be done but more on that later)

SCOM 2016 Installation

The installation is similar as we know, select your components and go ! For reference on the report viewer, I have also added a PowerShell Script which installs or downloads these components for you.

 

prerequisites for   console:

Reportviewer 2015 – https://www.microsoft.com/en-us/download/details.aspx?id=45496

SQL CLR Types 2014  – https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/SQLSysClrTypes.msi

 

Or simply use my updated PowerShell prerequisites script – http://www.owl-it.nl/uncategorized/scom-2016-2012-prerequisites-on-windows-server-2016-2012/

clip_image001 clip_image001[4]
clip_image001[6] clip_image001[8]
<img title="clip_image001[10]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image001[10]" src="http://www apotheke online cialis.owl-it.nl/wp-content/uploads/2016/10/clip_image00110_thumb.png” width=”244″ height=”184″> clip_image001[12]
clip_image001[14] clip_image001[16]
clip_image001[18] clip_image001[20]
clip_image001[22] clip_image001[24]

Okay install!

clip_image001[26]

Nooo Come on not again! I have had my share of failed installations during my days believe me …GRR Sad smile

okay here we go to trouble shooting endlessly and ……hmmm wait to soon … just a remark about eval …pffff Smile

Reporting

Installation of the reporting console

Don’t forget to configure and test the reporting websites prior to installing!

clip_image001[1] clip_image001[3]
clip_image001[5] clip_image001[7]
clip_image001[9] clip_image001[11]
clip_image001[13] clip_image001[15]
clip_image001[17] clip_image001[19]
image  

 

Up next the web console….

Web Console

I started the installation for the web portal part.

I decided to use the prerequisites script from my SCOM buddy Kevin Green –

And changed it to Windows Server 2016, Where you have the option to choose if 2016 or not.

If yes it will install the 2016 prerequisites if No the “old” version of the script is used.

When I was testing this the installation kept complaining about missing component:

image

 

Figured since it is all based on .net framework 4.5 now no longer .net 3.5 is required, right?

Nope Sad smile still .Net Framework 3.5 required…….really !?!!?

So you still need the Windows Server 2016 bits to install .net framework 3.5 just for the console.

I decided not to even bother with the Web Console and when I decided this I noticed a blog post from my SCOM buddy Marnix Wolf – http://thoughtsonopsmgr.blogspot.nl/2016/09/scom-2016-web-console-no-more.html?utm_source=twitterfeed&utm_medium=twitter

And couldn’t agree more with Marnix!

Still on .net framework 3.5 dependency and to top this… still the legacy, crappy old silverlight… noooo

My recommendation….just go with the squared up version – https://squaredup.com/ there is even a free community version now Smile

If you want to install the WebConsole you can use my updated PowerShell prereq script –

 

Issues

After installation I started up the console and no big changes except for the maintenance schedules.

Clicking it immediately gave me an error message stating my data access account had not enough access to run a sp on the msdb database.

EXECUTE Permission was denied on the object ‘sp_help_jobactivity’ database ‘msdb’ schema ‘dbo’

 

clip_image001[28]

a temporary fix for this was granting the Data access account sys admin on the SQL server.

This is quick and dirty fix just for lab purposes but this should be fixed I assume in the final release version.

After checking the maintenance I opened the Administration console to check the management packs and other settings.

opened the Tune Management packs pane and again struck by an error message:

image

Not sure what caused this but after closing the console and re-opening it didn’t appear anymore, maybe I was to fast Winking smile

 

Will post more on the new features and new stuff soon Smile

 

Cheers,

Oskar Landman

Geplaatst in Uncategorized | 1 reactie

SCOM 2016 / 2012 Prerequisites on Windows Server 2016 / 2012

Since Windows Server 2016 has a slightly different setup for the roles and services (application role no longer available).

I have rewritten the script from Kevin Green to quickly install SCOM 2016 prerequisites.

Thanks Kevin Green , and Steve Beaumont and Tim McFadden to be precise!

It will ask if you are installing on Windows Server 2016, if yes the installation will use the Windows Server 2016 specific settings.

And if you are installing SCOM 2012 or SCOM 2016.

 

download – https://gallery.technet.microsoft.com/SCOM-2012-2016-Prerequisite-bf084c0a

Script “SCOM2012_2016_Prerequisites.ps1” – all

Script ““DownloadOnly_SCOM2012_2016_Prerequisites.ps1” only for downloading prerequisites

image

 

<img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://www.owl-it.nl/wp-content/uploads/2016/10/image_thumb-1 cialis bestellen ohne rezept.png” width=”242″ height=”149″>

image

image

It will download the installation files automatically.

 

If you prefer to download the installation files on another location just use below script  “DownloadOnly_SCOM2012_2016_Prerequisites.ps1”and copy folders to the installation server:

image

 

 

That’s it!

 

Cheers,

Oskar Landman

Geplaatst in Uncategorized | Een reactie plaatsen

SCOM Health Check Reports V3–SCOM 2012 Supported!

This is just a quick post on an update on the SCOM health check reports V3.

Several people asked for a 2012 version, since there were references to newer packs the pack needed to be updated. ( or downgraded to be honest Winking smile

Sorry for the delay this one has been laying around for a while. Received this version but “forget” to upload the version. My bad Sad smile

 

I would like to thank Natascia Heil for her great work on making a 2012 compatible version of the management pack.

All credits go to Natascia!

Please check her awesome work on her blog System Center Tipps –  https://systemcentertipps.wordpress cialis von lilly.com/

 

oh and for the updated version, I have attached it to the download.

 

Cheers,

Oskar Landman

Geplaatst in Uncategorized | Een reactie plaatsen