Storage Spaces–Retiring an old disk (Simple parity volumes)

September 8, 2019 Leave a comment

If you are using HyperV and storage spaces, you will encounter an issue where there is no simple way to retire any volume

image

In this case, i’m trying to retire the older 50GB virtual disks for the larger 100GBs one.

To do so, i first declare a variable to hold the disk i want to retire in by selecting the first disk that is <50GB

$theDisk = Get-PhysicalDisk | ? Size -lt 51GB | Select-Object -first 1

Thereafter, to retire the disk, run the following command

Set-PhysicalDisk -Usage Retired -InputObject $theDisk

and verify it by running Get-PhysicalDisk again

image

Once the disk is marked as Retired, you can run the Repair Job, in this case i’m rebuilding the DB virtual Disk

Repair-VirtualDisk -FriendlyName "DB Virtual Disk"

image

Once this is completed, you may then proceed to remove the disk from the storage pool

DLINK DSC-8300LH RTSP

November 25, 2018 Leave a comment

I happened to find the link to http://forums.dlink.com/index.php?topic=72715.0 which provided a list of useful commands for DSC-8300LH

In particular the following

NIPCA-API (Network IP Camera Application Programming Interface)
model=DCS-8000LH
brand=D-Link
version=1.01
build=01
hw_version=A
NIPCA-API = ver. 1.9.7
Syntax:
http://UserName:Password@CameraIP:Port/<CGI-URL&gt;?<parameter>=<value>[&<parameter>=<value>…]

Where:
<CGI-URL> is a URL of a CGI, e.g. "/common/info.cgi"
NIPCA-API details and more CGI-URL possibly compatible with DCS-8000LH are e.g. here:
http://www.trendnet.com/_uploads/helpdesk/tv-ip612xx_cgi-10.pdf
http://gurau-audibert.hd.free.fr/josdblog/wp-content/uploads/2013/09/CGI_2121.pdf
Camera configuration:
Run CGI-URL without parameters to obtain a list of available parameters and their values.
Camera info
/common/info.cgi
Check wifi networks and signal strength
/config/wlansurvey.cgi
/config/wireless.cgi
Get stream informations
/config/stream_info.cgi
vprofile1=H264
vprofileurl1=/video/ACVS-H264.cgi?profileid=1
Network config, e.g. change port
/config/network.cgi?httpport=XXXX&httpexternalport=YYYY
Camera name, location
/config/camera_info.cgi
Change wifi
/config/wireless.cgi?essid=Name&passphrase=Password
Microphone, its gain
/config/mic.cgi?enable=no&volume=0
Add/delete user or group, change password
The command changes the admin’s password successfully. However, it is not possible then to use that password to log in. I could create a new user in the group Users but only with a blank password.
/config/user_mod.cgi?name=UserName&password=XXXX&group=Users
/config/user_del.cgi?name=UserName
/config/user_list.cgi
/config/user_list.cgi?name=admin
/config/user_list.cgi?name=UserName
/config/group_list.cgi
UPNP disable
/config/upnp.cgi?upnpav=off&upnpcp=off
Contrast, brightness, saturation, flip, mirror, etc.
/config/sensor_info.cgi
/config/sensor.cgi?flicker=50&sharpness=40
Disable motion detection
/config/motion.cgi?enable=no
Disable audio detection
/config/audio_detection.cgi?enable=no
LED on/off
/config/led.cgi?led=off
Infra off, day mode
/config/icr.cgi?mode=day&night_irled=off
Reboot, reset
/config/system_reboot.cgi?reboot=go
/config/system_reset.cgi?reset=go
Get a JPEG image
/image/jpeg.cgi
Date, time
/config/datetime.cgi
Get URL entry of specified profile
/config/rtspurl.cgi?profileid=1
Check video profile
/config/video.cgi?profileid=1
Change codec of profile 1 to MJPEG stream and back to H264
/config/video.cgi?profileid=1&codec=MJPEG
/config/video.cgi?profileid=1&codec=H264
Watch MJPEG stream, after the codec change, in web browser
http://UserName:Password@CameraIP:Port/video/mjpg.cgi

However nothing pointed to a RTSP link and in fact most of the forums seems to indicate otherwise. Until i found out that the RTSP url is..

FULL HD: rtsp://admin:admin@[ip addr]:554/stream1

720p: rtsp://admin:admin@[ip addr]:554/stream2

Categories: Uncategorized

Azure Portal–Obtaining access to billing invoices

December 6, 2017 Leave a comment

This guide details the steps required to obtain access to billing invoices for Azure portal (portal.azure.com)

  1. Login to portal.azure.com as the OWNER of the subscription
  2. Switch to the appropriate Azure AD
    image_thumb[4]
  3. Click on “Cost Management & Billing
    image_thumb[6]
  4. Click on “Subscriptions
    image_thumb[9]
  5. Select the appropriate subscription that you want to share access to

  6. Click on “Access to Invoice
    image

  7. Select “On” and then click “Save
    image
  8. Now users with subscription level access will be able to download the billing invoices
    image
Categories: Azure

Azure Portal–Setting up partner on record

December 6, 2017 Leave a comment

This guide details the steps required to setup the partner on record for Azure portal (portal.azure.com)

  1. Login to portal.azure.com
  2. Switch to the appropriate Azure AD
    image
  3. Click on “Cost Management & Billing
    image
  4. Click on “Subscriptions
    image
  5. Select the appropriate subscription that you want to set the Partner on Record
  6. Click on “Partner Information
    image
  7. Enter your Partner ID and click Save
Categories: Azure

Enabling Application Insights on ANY ASP.NET website

October 22, 2017 Leave a comment

1. Install DLL via Nuget

Install-Package Microsoft.ApplicationInsights.Web

2. Add items in bold to the relevant sections in web.config

<system.web>
<httpModules>
     <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
   </httpModules>

<system.webServer>
   <modules>
     <remove name="TelemetryCorrelationHttpModule"/>
     <add name="TelemetryCorrelationHttpModule"
       type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation"
       preCondition="integratedMode,managedHandler"/>
     < remove name="ApplicationInsightsWebTracking"/>
     <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
        preCondition="managedHandler"/>
   </modules>

<system.diagnostics>
  <trace autoflush="true" indentsize="0">
    <listeners>
      <add name="myAppInsightsListener" type="Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener, Microsoft.ApplicationInsights.TraceListener" />
    </listeners>
  </trace>
< /system.diagnostics>

3. Create an ApplicationInsights.config file in /

<?xml version="1.0" encoding="utf-8"?>
< ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
 
  < InstrumentationKey>[Your Instrumentation Key]</InstrumentationKey>
  < TelemetryInitializers>
    <Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
      <!– Extended list of bots:
             search|spider|crawl|Bot|Monitor|BrowserMob|BingPreview|PagePeeker|WebThumb|URL2PNG|ZooShot|GomezA|Google SketchUp|Read Later|KTXN|KHTE|Keynote|Pingdom|AlwaysOn|zao|borg|oegp|silk|Xenu|zeal|NING|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|Java|JNLP|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr-agent|http client|Python-urllib|AppEngine-Google|semanticdiscovery|facebookexternalhit|web/snippet|Google-HTTP-Java-Client–>
      <Filters>search|spider|crawl|Bot|Monitor|AlwaysOn</Filters>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
  </TelemetryInitializers>
  < TelemetryModules>
     <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
      < ExcludeComponentCorrelationHttpHeadersOnDomains>
         <!–
        Requests to the following hostnames will not be modified by adding correlation headers.
        This is only applicable if Profiler is installed via either StatusMonitor or Azure Extension.
        Add entries here to exclude additional hostnames.
        NOTE: this configuration will be lost upon NuGet upgrade.
        –>
        <Add>core.windows.net</Add>
         <Add>core.chinacloudapi.cn</Add>
        <Add>core.cloudapi.de</Add>
        <Add>core.usgovcloudapi.net</Add>
      </ExcludeComponentCorrelationHttpHeadersOnDomains>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
      <!–
      Use the following syntax here to collect additional performance counters:
     
      <Counters>
         <Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
        …
      </Counters>
     
      PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
      
      NOTE: performance counters configuration will be lost upon NuGet upgrade.
     
      The following placeholders are supported as InstanceName:
        ??APP_WIN32_PROC?? – instance name of the application process  for Win32 counters.
        ??APP_W3SVC_PROC?? – instance name of the application IIS worker process for IIS/ASP.NET counters.
        ??APP_CLR_PROC?? – instance name of the application CLR process for .NET counters.
       –>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">
      <!–</Add>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.FirstChanceExceptionStatisticsTelemetryModule, Microsoft.AI.WindowsServer">–>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
      <Handlers>
        <!–
        Add entries here to filter out additional handlers:
       
        NOTE: handler configuration will be lost upon NuGet upgrade.
        –>
        <Add>System.Web.Handlers.TransferRequestHandler</Add>
        <Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
        <Add>System.Web.StaticFileHandler</Add>
        <Add>System.Web.Handlers.AssemblyResourceLoader</Add>
         <Add>System.Web.Optimization.BundleHandler</Add>
        <Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
         <Add>System.Web.Handlers.TraceHandler</Add>
        <Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
        <Add>System.Web.HttpDebugHandler</Add>
      </Handlers>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
    <Add Type="Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule, Microsoft.AI.Web"/>
  </TelemetryModules>
  < TelemetryProcessors>
     <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
      < MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
      < ExcludedTypes>Event</ExcludedTypes>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
      <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
       <IncludedTypes>Event</IncludedTypes>
    </Add>
  </TelemetryProcessors>
  < TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
< !–
    Learn more about Application Insights configuration with ApplicationInsights.config here:
    http://go.microsoft.com/fwlink/?LinkID=513840
   
    Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
  –></ApplicationInsights>

Categories: ASP.NET, Azure

Enable FULL mailbox auditing in Office365

September 29, 2017 Leave a comment

If you have followed the steps found at https://support.office.com/en-us/article/Enable-mailbox-auditing-in-Office-365-aaca8987-5b62-458b-9882-c28476a66918, you would have realized that not every action is recorded

image

In the event you want to turn on all of the auditing capabilities, you will need to run the following PS script instead

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -AuditOwner  Create,SoftDelete,HardDelete,Update,Move,MoveToDeletedItems,MailboxLogin

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -AuditDelegate Create, FolderBind, SendAs,SendOnBehalf, SoftDelete, HardDelete, Update, Move,MoveToDeletedItems

Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -AuditAdmin Create, FolderBind, MessageBind, SendAs, SendOnBehalf,SoftDelete, HardDelete, Update, Move, Copy,MoveToDeletedItems

Which will give you the following result when you run Get-Mailbox "[userid]"| FL Audit*

image

Categories: Uncategorized

InvoicePlane v1.4.10 – Enabling Date Parameters

November 29, 2016 Leave a comment

As an update to https://jefferytay.wordpress.com/2016/02/25/invoiceplaneenabling-date-parameters/

File: Application\helpers\pdf_helper.php
Action:
Replace
    $items = $CI->mdl_items->where(‘invoice_id’, $invoice_id)->get()->result();   
with
    $items = $CI->mdl_items->get_items_and_replace_vars($invoice_id, $invoice->invoice_date_due);

image

File: application\modules\guest\controllers\view.php
Action:
Replace
    ‘items’ => $this->mdl_items->where(‘invoice_id’, $invoice->invoice_id)->get()->result(),
with
    ‘items’ => $this->mdl_items->get_items_and_replace_vars($invoice->invoice_id, $invoice->invoice_date_due),

image

File: application\modules\invoices\models\mdl_items.php
Action:
Add the following lines after "class Mdl_Items extends Response_Model {"

    ///Modify – ADDED
    public function get_items_and_replace_vars($invoice_id, $invoice_date_created = ‘now’)
    {
         $items = array();
         $query = $this->where(‘invoice_id’, $invoice_id)->get();

         foreach($query->result() as $item) {
             $item->item_name = $this->parse_item($item->item_name, $invoice_date_created);
             $item->item_description = $this->parse_item($item->item_description, $invoice_date_created);
             $items[] = $item;
         }
         return $items;
    }

    //Modify – ADDED
    private function parse_item($string, $invoice_date_created)
    {
        if (preg_match_all(‘/{{{(?<format>[yYmMdD])(?:(?<=[Yy])ear|(?<=[Mm])onth|(?<=[Dd])ay)(?:(?<operation>[-+])(?<amount>[1-9]+))?}}}/m’, $string, $template_vars, PREG_SET_ORDER)) {
              try {
                $formattedDate = new DateTime($invoice_date_created);
              }
              catch(Exception $e) { // If creating a date based on the invoice_date_created isn’t possible, use current date
                $formattedDate = new DateTime();
              }

              /* Calculate the date first, before starting replacing the variables */
              foreach($template_vars as $var) {
                  if(!isset($var[‘operation’], $var[‘amount’])) continue;

                  if($var[‘operation’] == ‘-‘) {
                      $formattedDate->sub( new DateInterval(‘P’ . $var[‘amount’] . strtoupper($var[‘format’])) );
                  }
                  else if($var[‘operation’] == ‘+’) {
                      $formattedDate->add( new DateInterval(‘P’ . $var[‘amount’] . strtoupper($var[‘format’])) );
                  }
              }

              /* Let’s replace all variables */
              foreach($template_vars as $var) {
                  $string = str_replace($var[0], $formattedDate->format($var[‘format’]), $string);
              }
        }

        return $string;
    }

image

Categories: Invoice Plane, Open Source