Tag: PowerShell
-
PowerShell wrapper function to display a dialog box
I wanted a function that I could pass some text, and it would put that text in a dialog box for the user to click okay. Simple, but I will reuse it I am sure.
-
PowerShell script to change default prf imported when Outlook starts up for the first time
In this previous post, I talk about how we use Office Customization Tool (OCT) and “.prf” files to deploy Office 2010. Continuing with the idea that I want to know if a person is visiting from another office, I want to be able to switch from our default of “cached mode” to “online mode” for…
-
PowerShell: Two functions to determine if a user is visiting the office
If you have users in distribution groups associated with each site in your organization, it should be easy to tell if a user is visiting from another office (more on why I want to do this later). First function returns the current site that the user is logging into: The second function loops through all…
-
PowerShell to verify ACLs (permissions) on a folder
In my previous post, I showed how to create a new ACL and apply it to a folder. Why apply it to the folder if the folder is already set correctly? I wrote the following function to compare the ACLs of a folder to a desired set of ACLs (either created by hand (lines 3-12) or…
-
PowerShell to assign permission to a folder (not copy inherited permissions)
In my previous post, I used PowerShell to change the permissions of a top level folder. In that script, I took the folder in question and copied the inherited permissions to it, and then I tinkered it to be what I wanted. I wanted to do something similar, but I wanted a set of permission…
-
PowerShell: Return, ForEach,ForEach-Object and a pipe
I just figured this out late last night. I was pulling my hair out. If you look at the following PowerShell code You get a result of: 1 2 3 4 5 Next, if you look at this code (the only real difference being the lack of a pipe.) You get: 1 2 3 That…
-
PowerShell code to split a space delimited string – with double spaces
I am working on a PowerShell wrapper script to run multiple commands on multiple machines. The first thing I wanted to do was to chop up a space or comma delimited argument. (If you make an argument mandatory, and the user does not provide it, PowerShell will prompt you for it – and when prompted…
-
Start Visual Studio form PowerShell
I am moving on to a new project – our migration from SharePoint 2007 to 2010. First thing I wanted to do was to upgrade my Solutions/Features from 2007 to 2010. I installed Visual Studio and started looking at how to recreate my Delegate JQuery Control (more on that later). The first thing I found annoying…
-
PowerShell wrapper script to send email
I wanted a standard function that I can call from other scripts to send email. I needed multiple recipients, and default sender and smtp arguments. Here is the script that I came up with.
-
PowerShell script to add users to a group
In this previous post : PowerShell wrapper for creating a new distribution group, I created a script for creating a new distribution group. I wanted to take that a step further and prompt the SysAdmin to add users. I created a new recursive function called AddToDistributionGroup. In this code, I prompt for a group name, and…
