Thursday, August 31, 2017

Install a Windows service using a Windows command prompt

run CMD as Administrator:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" "c:\myservice.exe"

Tuesday, May 23, 2017

DiskPart to extend a volume from CMD

1: Go to Start, Run, then type

cmd

2:Type
diskpart

3: Type
list volume
to list the current volumes. The list will look like

  Volume ### Ltr Label Fs Type       Size  Status   Info
   ---------- --- ------------------- ----- -------- -------
   Volume 0   C   NTFS Partition      10 GB Healthy  System
   Volume 1   D   Data NTFS Partition  9 GB Healthy  Pagefile

4 Type
select volume <volume number>

to select the volume you want to extend.
5 Type
extend

to extend the selected volume. If you don't pass any parameters, DiskPart will use all unpartitioned space on the current disk. Alternatively, you can type

extent size=<size in MB> disk=<disk number>

to set a size and disk to use for the extension.
6 type
exit

Thursday, May 11, 2017

Create mailboxes Exchange from PowerShell

Create mailboxes from OU Exchange from PowerShell:

Set-AdServerSettings -ViewEntireForest $True
Get-User  -DomainController  dc01.test.local -OrganizationalUnit "OU=Organizations,DC=test,DC=local" | Enable-Mailbox -Database "MBX-name" -AddressBookPolicy "Your ABP"

Tuesday, April 25, 2017

Sharepoint list pop up

<script language="javascript" type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script language="javascript" type="text/javascript">
        ExecuteOrDelayUntilScriptLoaded(yourFunction, 'SP.js');
        function yourFunction() {
            var options = { url: '/Lists/Notification/AllItems.aspx', title: 'Information ! ', width: 640, height: 400 };
             SP.UI.ModalDialog.showModalDialog(options);
         }
         
         _spBodyOnLoadFunctionNames.push("yourFunction()");
    </script>

Thursday, April 20, 2017

Sharepoint hide ribbonrow bar

<style>
#suiteBar, #s4-ribbonrow
{
    display: none;
}
</style>

Open attachments in new tab script Sharepoint

<script language="javascript" type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script language="javascript" type="text/javascript">
$(document).ready(function(){
        $("table#idAttachmentsTable a").attr('onclick', '').click(function (event) {
            event.preventDefault();
            var url=$(this).attr('href');
            window.open(url, '_blank');
        });
    });
</script>

Open document in new tab sharepoint

Open document in new tab sharepoint script:


<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>  
<script language="javascript" type="text/javascript">
$(document).ready(
  function ()
  {
    // has to be on an interval for grouped doc libraries
    // where the actual links are loaded only once a group
    // is expanded
    setInterval(
      function ()
      {
        $("a[onclick*='return DispEx'][target!='_blank']")
          .attr("target", "_blank")
          .removeAttr("onclick");

        // document type icons
        $("td.ms-vb-icon>img[onclick]:not([documentUrl])")
          .click(function (e)
          {
            window.open($(this).attr("documentUrl"), "_blank");
            e.stopPropagation();
            e.preventDefault();
            return false;
          })
          .each(function ()
          {
            $(this).attr(
            "documentUrl",
            $.trim(String($(this).attr("onclick"))
              .split("=")[1]
              .replace(/["'{}]/g, "")
              .split(";")[0])
            );
            this.onclick = null;
          });
      },
      500
    );
  }
);
</script>