SSRS – Multi Select Drop down based on a Query Data Source

October 31, 2019

If you need a Multi Select Drop down box that fills up dynamically…

This is the way to do it.

1. Create a new data set

That holds the query to populate the drop down box.

image

Make sure you set the WHERE clause to point to new Multi Select Parameter

2. Create a new Parameter

Set the parameter settings to ALLOW MULTIPLE VALUES 

image

And next set the available values to retrieve the data from the above Query

image

Next in Advance use these settings

image

4. Main ‘DataSet1’ Query selection settings

In the main dataset make sure that you set the WHERE clause :

To point to the parameter using this format IN (@yourparameter)

image

IMPORTANT : Notice the brackets around the Parameter name !

If you forget them you will get errors !

5. Result

The result is that your drop down box will populate dynamically,

based on the previous parameter values

image

Really cool  Smile

Enjoy !


Windows Server 2016–Sync Time Server using (S)NTP

October 30, 2019

How to sync the time to a public time server using NTP

 

You need to use the w32tm command.

 

First check the current settings :

 

w32tm /query /status

image

What about the 0x1 parameter ?

https://support.microsoft.com/en-us/help/875424/time-synchronization-may-not-succeed-when-you-try-to-synchronize-with

  • 0x01 – Use special poll interval Special Interval
  • 0x02 – Use As Fall back Only
  • 0x04 – Send request as Symmetric Active mode
  • 0x08 – Send request as Client mode

 

To set a new External Time Server like pool.ntp.org use this command :

net stop w32time

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL

net start w32time

w32tm /resync

 

This is the configuration :

w32tm /query /configuration

image

These are all the command line switches :

 

w32tm [/? | /register | /unregister ]
? – this help screen.
register – register to run as a service and add default
configuration to the registry.
unregister – unregister service and remove all configuration
information from the registry.

w32tm /monitor [/domain:<domain name>]
[/computers:<name>[,<name>[,<name>…]]]
[/threads:<num>] [/ipprotocol:<4|6>] [/nowarn]
domain – specifies which domain to monitor. If no domain name
is given, or neither the domain nor computers option is
specified, the default domain is used. This option may be
used more than once.
computers – monitors the given list of computers. Computer
names are separated by commas, with no spaces. If a name is
prefixed with a ‘*’, it is treated as an AD PDC. This option
may be used more than once.
threads – how many computers to analyze simultaneously. The
default value is 3. Allowed range is 1-50.
ipprotocol – specify the IP protocol to use. The default is
to use whatever is available.
nowarn – skip warning message.

w32tm /ntte <NT time epoch>
Convert a NT system time, in (10^-7)s intervals from 0h 1-Jan 1601,
into a readable format.

w32tm /ntpte <NTP time epoch>
Convert an NTP time, in (2^-32)s intervals from 0h 1-Jan 1900, into
a readable format.

w32tm /resync [/computer:<computer>] [/nowait] [/rediscover] [/soft]
Tell a computer that it should resynchronize its clock as soon
as possible, throwing out all accumulated error statistics.
computer:<computer> – computer that should resync. If not
specified, the local computer will resync.
nowait – do not wait for the resync to occur;
return immediately. Otherwise, wait for the resync to
complete before returning.
rediscover – redetect the network configuration and rediscover
network sources, then resynchronize.
soft – resync utilizing existing error statistics. Not useful,
provided for compatibility.

w32tm /stripchart /computer:<target> [/period:<refresh>]
[/dataonly] [/samples:<count>] [/packetinfo] [/ipprotocol:<4|6>]
Display a strip chart of the offset between this computer and
another computer.
computer:<target> – the computer to measure the offset against.
period:<refresh> – the time between samples, in seconds. The
default is 2s
dataonly – display only the data, no graphics.
samples:<count> – collect <count> samples, then stop. If not
specified, samples will be collected until Ctrl-C is pressed.
packetinfo – print out NTP packet response message.
ipprotocol – specify the IP protocol to use. The default is
to use whatever is available.

w32tm /config [/computer:<target>] [/update]
[/manualpeerlist:<peers>] [/syncfromflags:<source>]
[/LocalClockDispersion:<seconds>]
[/reliable:(YES|NO)]
[/largephaseoffset:<milliseconds>]
computer:<target> – adjusts the configuration of <target>. If not
specified, the default is the local computer.
update – notifies the time service that the configuration has
changed, causing the changes to take effect.
manualpeerlist:<peers> – sets the manual peer list to <peers>,
which is a space-delimited list of DNS and/or IP addresses.
When specifying multiple peers, this switch must be enclosed in
quotes.
syncfromflags:<source> – sets what sources the NTP client should
sync from. <source> should be a comma separated list of
these keywords (not case sensitive):
MANUAL – sync from peers in the manual peer list
DOMHIER – sync from an AD DC in the domain hierarchy
NO – sync from none
ALL – sync from both manual and domain peers
LocalClockDispersion:<seconds> – configures the accuracy of the
internal clock that w32time will assume when it can’t acquire
time from its configured sources.
reliable:(YES|NO) – set whether this machine is a reliable time source.
This setting is only meaningful on domain controllers.
YES – this machine is a reliable time service
NO – this machine is not a reliable time service
largephaseoffset:<milliseconds> – sets the time difference between
local and network time which w32time will consider a spike.

w32tm /tz
Display the current time zone settings.

w32tm /dumpreg [/subkey:<key>] [/computer:<target>]
Display the values associated with a given registry key.
The default key is HKLM\System\CurrentControlSet\Services\W32Time
(the root key for the time service).
subkey:<key> – displays the values associated with subkey <key>
of the default key.
computer:<target> – queries registry settings for computer <target>.

w32tm /query [/computer:<target>]
{/source | /configuration | /peers | /status}
[/verbose]
Display a computer’s windows time service information.
computer:<target> – query the information of <target>. If not
specified, the default is the local computer.
source: display the time source.
configuration: display the configuration of run-time and where
the setting comes from. In verbose mode, display the undefined
or unused setting too.
peers: display a list of peers and their status.
status: display windows time service status.
verbose: set the verbose mode to display more information.

w32tm /debug {/disable | {/enable /file:<name> /size:<bytes> /entries:<value>
[/truncate]}}
Enable or disable local computer windows time service private log.
disable: disable the private log.
enable: enable the private log.
file:<name> – specify the absolute filename.
size:<bytes> – specify the maximum size for circular logging.
entries:<value> – contains a list of flags, specified by number and
separated by commas, that specify the types of information that
should be logged. Valid numbers are 0 to 300. A range of numbers
is valid, in addition to single numbers, such as 0-100,103,106.
Value 0-300 is for logging all information.
truncate: truncate the file if it exists.

 

Now that you set the server to properly sync you can use this one as internal NTP server for other devices.

 

TIP :

Keep in mind to set the firewall UDP 123 rules to accept.

 

More info see here

 

Enjoy !


Switch – Trace device Mac Address to Port number

October 23, 2019

 

Sometimes it can be a pain to trace back which device is connected to which port on the Switch ?

image

Especially when you have multiple VLANs it is critical that you use the correct port configuration to make everything work.

So we will you an IP Scanner combined with some Telnet session access to the switch to find what we need.

 

SOLUTION :

First you scan your network using any kind of IP Scanner that lists the IP / MAC Address combination.

 

image

Next you can have to make a Telnet session to the Switch to list all Mac Addresses

I use the famous PuTTY to connect the switch using Telnet

Use these commands to list the Mac Addresses for a HP – Aruba & CISCO Switch

HP Aruba :
--------------
Show mac-address
Show mac-address VLAN 1

MAC ->  Port
dis mac-address 4851b7-64c5b2

PORT -> MAC
dis mac-address interface 29

Cisco :
---------
show mac address-table

MAC ->  Port
show mac-address-table address 0016.35ae.8380

PORT -> MAC
show mac address-table interface f0/13

image

 

image

TIP : If you want to EXPORT the list for documentation purposes.

Turn on the LOGGING setting as Printable Output

 

image

Now that you have the link between the MAC address and the PORT # you can easily find back the device

If you want to trace back the device by MANUFACTURER NAME you can use the ADVANCED IP SCANNER

image

https://www.advanced-ip-scanner.com/

image

Enjoy !


Windows Server 2016 – Get Boot Date & Time – Uptime

October 21, 2019

How to get Windows Server 2016 Boot Date & Time – Uptime

There are several ways to get this information :

1. Command line :


systeminfo
| find “System Up Time”

image

2. Command line Tools :

– SysInternals :
psinfo.exe
| Find “uptime”

image

– SysInternals : BgInfo.exe Display as background

image

3. WMI

wmic
OS GET CSName,LastBootUpTime

image

4. PowerShell

$obj = Get-WmiObject Win32_OperatingSystem
 $obj.ConvertToDateTime($obj.LastBootUpTime)

image

Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime

image

get-eventlog System | where-object {$_.EventID -eq "6013"} | sort -desc TimeGenerated

new-timespan -Seconds 26079971 | Select Days,Hours,Seconds

image

5. Event Viewer

Filter the System events with the Event ID 6013

image

Enjoy !


PowerShell – Monitor CPU Cores Temperatures

October 19, 2019

In order to Monitor the Temperature of your CPU Cores it is best to make use of OpenHardwareMonitorLib

 

image

You can download it here.

 

This nice application has a .Net Library that you can use to access the Hardware Sensors Data

It also exposes the values to WMI when the GUI is started, but that is not so convenient for monitoring

 

SOLUTION :

# Needs admin privileges and the .NET OpenHardwareMonitorLib.dll

#Requires -RunAsAdministrator

CLS

Add-Type -Path "C:\OpenHardwareMonitor\OpenHardwareMonitorLib.dll"

$Comp = New-Object -TypeName OpenHardwareMonitor.Hardware.Computer

$Comp.Open()

$Comp.CPUEnabled = $true

$Comp.RAMEnabled = $true

$Comp.MainboardEnabled = $true

$Comp.FanControllerEnabled = $true

$Comp.GPUEnabled = $true

$Comp.HDDEnabled = $true

ForEach ($HW in $Comp.Hardware) {

$HW.Update()
    $hw.HardwareType.ToString() + ' - ' + $hw.name.ToString()

    If ( $hw.HardwareType -eq "CPU"){
        ForEach ($Sensor in $HW.Sensors) {

        If ($Sensor.SensorType -eq "Temperature"){
            
            $Sensor.Name + ' - Temp : ' + $Sensor.Value.ToString() + ' C - Min. : ' + $Sensor.Min.ToString() + ' C - Max : ' + $Sensor.Max.ToString() + ' C'
        }
      }
    }
   
    # $hw.Sensors
    $hw.SubHardware
}
$Comp.Close()

 

image

 

If you add an Email Notifications when it reaches the MAX values, you have a nice Monitoring System Smile

Enjoy !


PowerShell – How to access Exchange Online Resource Mailbox Calendar

October 18, 2019

We are using the EVOKO Liso booking system, that is linked to Office 365 – Exchange Online

Where each meeting room has a tablet to book the rooms or equipment

image

Once booked on the Tablet it shows in Outlook, or the other way around.

If booked in Outlook it shows on the Tablet hanging on the wall beside the meeting room Smile

image

Fiarly easy to use and manage ..

But how to get access to the Exchange Online Resource Mailbox Resource Calendar

Or have a quick access to all bookings now and in the future Sad smile

SOLUTION :

First you need to check if the Resource Mailbox has the status PublishEnabled

Run this Powershell command and check the property : PublishedCalendarUrl


Get-MailboxCalendarFolder -Identity ResourceMailboxEmail@YourCompany.com:\calendar

image

If this is blank you need to set the Recourse Mailbox to PublishEnabled

Run this command to change it :

Set-MailboxCalendarFolder -Identity ResourceMailboxEmail@YourCompany.com:\calendar -PublishEnabled $true

image

Run the Get-MailboxCalendarFolder command again to check the result and copy the URL

You can also configure it using the OWA web interface


image

You can also set the permissions here, where you define the view permissions

image

Don’t forget the set the correct timezone / date and time format … for each resource calendar !

image

TIP :

The URL exposed is not 100% correct in order to use it, you need to change it to HTTPS://….

At least now you can have a nice DAY / WEEK or MONTH overview  Smile

image

Keep in mind that it can take up to 24 Hrs to sync all of the intermediate changes in the calendar.

Exchange Online Calendar in SharePoint Online :

This is not supported see here  Sad smile

When you configure it all looks OK but there is an error message shown on top.

– Outlook Web Access URL : See above MailboxCalendarFolder : https://outlook.office365.com/owa/calendar/cef36771d9a042ec9d683890b1902915@……

– Exchange Web Service URL: https://outlook.office365.com/EWS/Exchange.asmx

image

Error :

The HTTP request is unauthorized with client authentication scheme ‘Ntlm’.

The authentication header received from the server was ‘Basic Realm=””‘.


image

But if you click the Overlay button it works by jumping to the Exchange Calendar Web Page.

image

Enjoy !!