Author: jbmurphy
-
PowerShell, JSON, oData and CRM 2011 (or SharePoint 2010)
I am working on how to consume data from/to SharePoint 2010 and from/to CRM 2011. I decided to try and see if I can get the data to display in PowerShell, figuring if I can get it there, I should be able to get it anywhere? Here is the code to loop through all the…
-
How to tell if your PowerShell session is remote
I wanted to write a conditional to prevent certain things from runing if in a remote PSSession. If you are in a standard PowerShell session the following is returned: [Environment]::GetCommandLineArgs()[0] = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe If you are in a remote PSSession: [Environment]::GetCommandLineArgs()[0] = C:\Windows\system32\wsmprovhost.exe
-
How to add custom CSS code to all SharePoint 2010 pages (CustomAction)
It occurred to me that you can add a CSS link to the top of each page using the same method that I showed in this post. The only thing you change is the code in “CustomAction”. The code would be”
-
How to add custom JavaScript code to all SharePoint 2010 pages (CustomAction)
There are plenty or articles on how to do this. This is more of a note for myself, as I have to “re-learn” this every time I need to customize SharePoint. There are 2 ways (that I know of) that you can add code to every page in SharePoint 2010, 1 by the AdditionalPageHead delegate…
-
How to use Visual Studio to package a SharePoint solution if you don’t have SharePoint installed
I re-image my machine often, and when I fire up a Visual Studio 2010 for the first time, I always get an error “To work with this project, either SharePoint Foundation 2010 or SharePoint Server 2010 must be installed on the system” or “A SharePoint server is not installed on this computer. A SharePoint server…
-
How to tell if your PowerShell function was called by name or by alias
I been wanting to write functions that act differently depending on how they were called. I am not sure if this is good practice or not, but I like the idea. Turns out all you need is “$MyInvocation.InvocationName” Look at they following code: If you call the function by alias you get : This function…
-
3000 Visitors on one month!
I remember thinking, when I hit 2000 visitors in a month, I will never make 3000!
-
PowerShell script to force download and install WindowsUpdates
I have been using the UpdateHF.vbs vbscript for years to patch all my servers. I wrote a simple HTA to wrap it, and it gets executed by psexec. I wanted to take that script, strip it down, and convert it to PowerShell. My intension was to run it through a PSSession but I get access…
-
PowerShell script to “process” scripts/functions
I was not happy with the code I wrote in this post. The goal was to write my functions with a “generic” naming convention, and then “process them” – change the naming convention to match my employer’s company name. For example JBMURPHY-AD-GetCurrentSite would be “processed” to Company-AD-GetCurrentSite. In the previous post, I just looped thought…
-
PowerShell script to make a WinPE USB drive
I wanted to take my previous set of scripts to create a WinPE environment a step further. I wanted a script to create a bootable WinPE USB drive (UFD). Here is that script (again it is numbered to indicate the order in which to run things). I borrowed the diskpart stuff from here:
