Posts Tagged ‘file’

How to save existing Document library as Template

Login to Sharepoint then navigate to the Document Library

Go to Library Settings

Save template ( with or without the content ) 

Next go to the Site where you want to create the new Library and create a new App ( NOT Document library )

Search for your new Template

And Add this with the new Name

GD Star Rating
GD Star Rating

Recently I tried to delete a stuck file in Explorer which produced the error 

Could not find this item , This item is no longer located in xxxxxx

I tried to user Command prompt, file unlocked and reboot the server to see if System had locked the file all unsucessfully.

In the end I have to use command prompt to rename the Parent Folder of the file

ren “Parent Folder Name” “Test”

This cleared and removed the file if not you should be able to delete this in Comand prompt and explorer , I was then able to rename this folder back or delete the folder if needed.

GD Star Rating
GD Star Rating

Login to SCCM server with a user who is a member of USR_SCCM_Admins group


First you will want to creation a collection ( selection of computers ) who you can test the policy with. SCCM has some premade ones, segregating Workstations and Servers with Operating Systems

Create a new collection ( right click New ) Choose a Name  and Click Next

Add an Individual PC can be added by choosing This Red High-Lighted Button and Using the Query to the left



Choose a Group of Computers Such as an OU can be added by using the Blue Highlighted button and the query below




Download the Application MSI from the website

Create a new Package – Enter the Name

Choose the datasource as a folder location in \\sccmserver\share$\Applications and you can leave everything else as defaults (if you only have one site)

After creation of the above Folder , copy all the files you need to install into this directory e.g. the MSI and and BAT Files. The Bat files might look something like this


@echo off
echo --------------------------------------------------------
echo .
echo . Installing Adobe Flash Player 18 - Please Wait
REM Installs Adobe Flash Player 18 and disables autoupdate checking
echo .
echo --------------------------------------------------------
REM Install Adobe Flash Player ActiveX
msiexec.exe /qb /norestart /i "%~dp0install_flash_player_18_active_x.msi"
REM Installing Adobe Flash Player Plugin
msiexec.exe /qb /norestart /i "%~dp0install_flash_player_18_plugin.msi"
REM Disable Auto Updates
REM Copy flash config file to C:\WINDOWS\system32\Macromed\Flash\
xcopy "mms.cfg" "C:\WINDOWS\system32\Macromed\Flash\" /Y
if exist "C:\Windows\SysWOW64\Macromed\Flash\" xcopy "%~dp0mms.cfg" "C:\Windows\SysWOW64\Macromed\Flash\" /e /i /h /y
if exist "C:\Windows\System32\Macromed\Flash\" xcopy "%~dp0mms.cfg" "C:\Windows\System32\Macromed\Flash\" /e /i /h /y
REM Return exit code to SCCM
exit /B %EXIT_CODE%

After creating the Package you need to Create a Program which references the files

Under the Package Program Folder , right click on Programs and choose New

Enter and Name and in Command Line reference the .bat file

Choose Next and choose the self-explanatory options

Distribute the Package via Advertisement

There are multiple ways to distribute a program through SCCM , but I prefer using the advertisement as it can be straight away!

Choose the options above and Choose the Package, Program and Collection you would like to deploy to

Choose Next , where you can put the start time this will which the advertised app will appear in peoples control panel

To force this to run for all users you will need to add a Mandatory Assignments Task where you can also set a schedule or immediate start time

Follow through the rest of the self-explantory options and click go when ready.

Sit back and wait!

To Check Status of the rollout

Software Distribution / Packages / Choose your Package / Pack Status / Your Office and click on the right hand Actions Show Messages and Choose ALL Choose the day range and click OK



GD Star Rating
GD Star Rating

Wow , possible my biggest EWS Powershell script, Big thanks go to Glen for the missing piece of the jigsaw. The project started as a way to copy Quick Copy settings between users when needed.

Outlook doesn’t provide much functionality to do this itself, you can use the famous redemtion.dll for this task , but I’m more of a server side guy than a client side, Our Outlook Enviroment has too many macros already!

I knew how to get more Inbox items , but have never dived into the “Associated Contents Table”. Using the free MFCMAPI.exe tool , I explored the mailbox to find the folder I need as well as the table and after hours or tinkering and borrowing code we are good!

You will need to go through and change the values in %

This is the download script , I will paste the SOAP upload script in another post

$mailbox = Get-Mailbox %mailbox%
$mailAddress = $mailbox.PrimarySmtpAddress.ToString();
[Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft\Exchange\Web Services\2.1\Microsoft.Exchange.WebServices.dll") | Out-Null
$s = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP1)
#needed for XML Soap
$cred = New-Object System.Net.NetworkCredential("%username%","%password%")
$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind
$s.Credentials = $cred
$MailboxRootid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot,$mailAddress)
$MailboxRoot = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s,$MailboxRootid)
# Get Folder ID from Path
Function GetFolder()
	# Return a reference to a folder specified by path
	$RootFolder, $FolderPath = $args[0];
	$Folder = $RootFolder;
	if ($FolderPath -ne '\')
		$PathElements = $FolderPath -split '\\';
		For ($i=0; $i -lt $PathElements.Count; $i++)
			if ($PathElements[$i])
				$View = New-Object  Microsoft.Exchange.WebServices.Data.FolderView(2,0);
				$View.Traversal = [Microsoft.Exchange.WebServices.Data.FolderTraversal]::Deep;
				$View.PropertySet = [Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly;
				$SearchFilter = New-Object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName, $PathElements[$i]);
				$FolderResults = $Folder.FindFolders($SearchFilter, $View);
				if ($FolderResults.TotalCount -ne 1)
					# We have either none or more than one folder returned... Either way, we can't continue
					$Folder = $null;
					Write-Host "Failed to find " $PathElements[$i];
					Write-Host "Requested folder path: " $FolderPath;
				$Folder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s, $FolderResults.Folders[0].Id)
#choose the folder name you want to download the Configuration items from
$folderobject = GetFolder($MailboxRoot, "\Quick Step Settings\");
$sfSearchFilter = new-object Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo([Microsoft.Exchange.WebServices.Data.ItemSchema]::ItemClass, "IPM.Microsoft.CustomAction")
$Itemview = new-object Microsoft.Exchange.WebServices.Data.ItemView(20)
$ItemView.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$ItemView.Traversal = [Microsoft.Exchange.Webservices.Data.ItemTraversal]::Associated
#$folderid = new-object  Microsoft.Exchange.WebServices.Data.Folderid([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Root,$mailAddress)
$folderid = $folderobject.Id
$InboxFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s,$folderid)
$pspropset = New-Object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.ItemSchema]::MimeContent)
$mails  = $inboxFolder.finditems($sfSearchFilter,$Itemview)
#loop to go through all the items in the folder
foreach($Item in $mails.Items)
#gets the id for the SOAP XML Request
$itemid = $mails.Items[$count].Id.Uniqueid
$expRequest = @"
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi=""
    <t:RequestServerVersion Version="Exchange2010_SP1" />
        <t:ItemId Id="$itemid"/>
$mbMailboxFolderURI = New-Object System.Uri($s.url)
$wrWebRequest = [System.Net.WebRequest]::Create($mbMailboxFolderURI)
$wrWebRequest.KeepAlive = $false;
$wrWebRequest.Headers.Set("Pragma", "no-cache");
$wrWebRequest.Headers.Set("Translate", "f");
$wrWebRequest.Headers.Set("Depth", "0");
$wrWebRequest.ContentType = "text/xml";
$wrWebRequest.ContentLength = $expRequest.Length;
$wrWebRequest.Timeout = 60000;
$wrWebRequest.Method = "POST";
$wrWebRequest.Credentials = $cred
$bqByteQuery = [System.Text.Encoding]::ASCII.GetBytes($expRequest);
$wrWebRequest.ContentLength = $bqByteQuery.Length;
$rsRequestStream = $wrWebRequest.GetRequestStream();
$rsRequestStream.Write($bqByteQuery, 0, $bqByteQuery.Length);
$wrWebResponse = $wrWebRequest.GetResponse();
$rsResponseStream = $wrWebResponse.GetResponseStream()
$sr = new-object System.IO.StreamReader($rsResponseStream);
$rdResponseDocument = New-Object System.Xml.XmlDocument
$Datanodes = @($rdResponseDocument.getElementsByTagName("m:Data"))
if ($Datanodes.length -ne 0){
	$Data = [System.Convert]::FromBase64String($Datanodes[0].'#text')
#file location
	$fsFileStream = new-object C:\%folder%\quickcopy$count, ([io.filemode]::create), ([io.fileaccess]::write), ([io.fileshare]::none)
	$fsFileStream.Write($Data, 0, $Data.Length);
$count= $count+1 


GD Star Rating
GD Star Rating