<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BasementJack &#187; admin</title>
	<atom:link href="http://basementjack.com/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://basementjack.com</link>
	<description>Jack&#039;s basement and some other stuff...</description>
	<lastBuildDate>Fri, 18 May 2012 20:26:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Revised &#8211; Powershell to list all the users in a site collection</title>
		<link>http://basementjack.com/uncategorized/revised-powershell-to-list-all-the-users-in-a-site-collection/</link>
		<comments>http://basementjack.com/uncategorized/revised-powershell-to-list-all-the-users-in-a-site-collection/#comments</comments>
		<pubDate>Fri, 18 May 2012 20:26:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=479</guid>
		<description><![CDATA[My last post had a simple script for dumping out all the users in a site collection &#8211; (the post said farm, but that wasn&#8217;t the code that got posted) I&#8217;ve had a chance (and need) to work with the script and made a few nice improvements There are a few commented out if statements [...]]]></description>
			<content:encoded><![CDATA[<p>My last post had a simple script for dumping out all the users in a site collection &#8211; (the post said farm, but that wasn&#8217;t the code that got posted)</p>
<p>I&#8217;ve had a chance (and need) to work with the script and made a few nice improvements</p>
<ul>
<li>There are a few commented out if statements you can uncomment if you want to search for a particular user or domain</li>
<li>The color output and indentation is a little better in this script</li>
<li>The code dumps all it&#8217;s output into a single CSV file you can import into Excel, Access or any tool of your likeing</li>
</ul>
<p>That last bullet point really can&#8217;t be under estimated.<br />
Some ideas:</p>
<ul>
<li>You can save the list as a reference of what your group memberships were on a given day (note I didnt say permissions)</li>
<li>You could import the list into access or excel, and do queries all day long</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#getalluserinaSiteCollection</span>
<span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> microsoft.sharepoint.powershell <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
<span style="color: #800080;">$iissite</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spwebapplication <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.url <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;http://www.yoursite.com/&quot;</span><span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$iissite</span>
<span style="color: #800080;">$header</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;type,user,group,weburl,webname&quot;</span>
<span style="color: #800080;">$header</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> filename.txt 
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$SiteCollection</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$iissite</span>.sites<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800080;">$SiteCollection</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Blue	
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$web</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$SiteCollection</span>.Allwebs<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span> 
         <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800000;">&quot;    &quot;</span> <span style="color: #800080;">$web</span>.url <span style="color: #800080;">$web</span>.name <span style="color: #800000;">&quot;users:&quot;</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> yellow
         <span style="color: #008000;"># Write-host &quot;        &quot; $web.users | select name </span>
         <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$userw</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$web</span>.users<span style="color: #000000;">&#41;</span>
         <span style="color: #000000;">&#123;</span>
            <span style="color: #008000;">#if ($userw -like &quot;Domain\*&quot;)</span>
            <span style="color: #008000;">#{</span>
				<span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800000;">&quot;        &quot;</span> <span style="color: #800080;">$userw</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> white
				<span style="color: #008000;">#$msg = (&quot;{0},{1} user:{2}&quot; -f $web.url,$web.name, $userw)</span>
				<span style="color: #800080;">$msg</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;RootUser,{0},-,{1},{2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$userw</span><span style="color: pink;">,</span> <span style="color: #800080;">$web</span>.url<span style="color: pink;">,</span><span style="color: #800080;">$web</span>.name<span style="color: #000000;">&#41;</span> 
				<span style="color: #800080;">$msg</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> filename.txt <span style="color: #008080; font-style: italic;">-append</span>
            <span style="color: #008000;">#  }</span>
           <span style="color: #000000;">&#125;</span>
&nbsp;
		 <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$web</span>.Groups<span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
                    <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800000;">&quot;        &quot;</span> <span style="color: #800080;">$web</span>.url <span style="color: #800080;">$group</span>.name: <span style="color: #008080; font-style: italic;">-foregroundcolor</span> green
		     <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$user</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$group</span>.users<span style="color: #000000;">&#41;</span>
             <span style="color: #000000;">&#123;</span> 
				<span style="color: #008000;"># if ($user -like &quot;DOMAIN\*&quot;)</span>
				 <span style="color: #008000;">#{   </span>
					  <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800000;">&quot;            &quot;</span> <span style="color: #800080;">$user</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> white
					  <span style="color: #008000;">#$msg = (&quot;{0},{1},group:{2}, user:{3}&quot; -f $web.url, $web.name, $group, $user)</span>
					  <span style="color: #800080;">$msg</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;GroupUser,{0},{1},{2},{3}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$user</span><span style="color: pink;">,</span> <span style="color: #800080;">$group</span><span style="color: pink;">,</span> <span style="color: #800080;">$web</span>.url<span style="color: pink;">,</span> <span style="color: #800080;">$web</span>.name<span style="color: #000000;">&#41;</span>
					  <span style="color: #800080;">$msg</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> filename.txt <span style="color: #008080; font-style: italic;">-append</span>
				 <span style="color: #008000;">#}</span>
             <span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>	
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/revised-powershell-to-list-all-the-users-in-a-site-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell to List all the users who have rights in your farm</title>
		<link>http://basementjack.com/sharepoint-2/powershell-to-list-all-the-users-who-have-rights-in-your-farm/</link>
		<comments>http://basementjack.com/sharepoint-2/powershell-to-list-all-the-users-who-have-rights-in-your-farm/#comments</comments>
		<pubDate>Thu, 17 May 2012 22:09:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[SharePoint2010]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=474</guid>
		<description><![CDATA[I had a migration project where we needed to know everywhere in the farm users from a specific domain were. The simple solution was the script below which lists out each sharepoint site, the direct users of the site the sharepoint groups in the site the users in the sharepoint groups 1 2 3 4 [...]]]></description>
			<content:encoded><![CDATA[<p>I had a migration project where we needed to know everywhere in the farm users from a specific domain were.</p>
<p>The simple solution was the script below which lists out<br />
each sharepoint site,<br />
the direct users of the site<br />
the sharepoint groups in the site<br />
the users in the sharepoint groups</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">&nbsp;
<span style="color: #008000;">#getalluserseverywhere</span>
<span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> microsoft.sharepoint.powershell <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
<span style="color: #800080;">$iissite</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spwebapplication <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.url <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;http://www.yoursite.com/&quot;</span><span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$iissite</span>
&nbsp;
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$SiteCollection</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$iissite</span>.sites<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800080;">$SiteCollection</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Blue	
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$web</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$SiteCollection</span>.Allwebs<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span> 
        <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800000;">&quot;    &quot;</span> <span style="color: #800080;">$web</span>.url <span style="color: #800080;">$web</span>.name <span style="color: #800000;">&quot;users:&quot;</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> yellow
        <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800000;">&quot;        &quot;</span> <span style="color: #800080;">$web</span>.users <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> name 
		 <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$web</span>.Groups<span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
                     <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800000;">&quot;        &quot;</span> <span style="color: #800080;">$web</span>.url <span style="color: #800080;">$group</span>.name: <span style="color: #008080; font-style: italic;">-foregroundcolor</span> green
		     <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$user</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$group</span>.users<span style="color: #000000;">&#41;</span>
                     <span style="color: #000000;">&#123;</span> 
                         <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800000;">&quot;            &quot;</span> <span style="color: #800080;">$user</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> white
                     <span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>	
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/sharepoint-2/powershell-to-list-all-the-users-who-have-rights-in-your-farm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Versions on every SharePoint Site</title>
		<link>http://basementjack.com/uncategorized/enable-versions-on-every-sharepoint-site/</link>
		<comments>http://basementjack.com/uncategorized/enable-versions-on-every-sharepoint-site/#comments</comments>
		<pubDate>Tue, 15 May 2012 05:22:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=469</guid>
		<description><![CDATA[As a follow up to the last article, this script will enable versions on every list on a given &#8220;web App&#8221; (IIS site) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction [...]]]></description>
			<content:encoded><![CDATA[<p>As a follow up to the last article, this script will enable versions on every list on a given &#8220;web App&#8221; (IIS site)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> microsoft.sharepoint.powershell <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
&nbsp;
<span style="color: #008000;">#note here - if you remove the where statement, you can do a foreach statement that lets you loop though each IIS site you have</span>
<span style="color: #800080;">$iissite</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spwebapplication <span style="color: pink;">|</span> <span style="color: #0000FF;">where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.url <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;http://www.yourwebsite.com/&quot;</span><span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$iissite</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$SiteCollection</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$iissite</span>.sites<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800080;">$SiteCollection</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Blue
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$oneweb</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$SiteCollection</span>.allwebs<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
	   <span style="color: #008080; font-weight: bold;">write-host</span>  <span style="color: #800080;">$iissite</span>.url <span style="color: #800080;">$oneweb</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Green
	   <span style="color: #008000;">#now this is is where we look at the lists</span>
	   <span style="color: #800080;">$lists</span> <span style="color: pink;">=</span> <span style="color: #800080;">$oneweb</span>.lists
       <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$list</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$lists</span><span style="color: #000000;">&#41;</span>
       <span style="color: #000000;">&#123;</span>
          <span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$list</span>.EnableVersioning <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$false</span><span style="color: #000000;">&#41;</span>
          <span style="color: #000000;">&#123;</span>
              <span style="color: #008080; font-weight: bold;">write-host</span>  <span style="color: #800080;">$iissite</span>.url $oneweb<span style="color: #800000;">&quot;/&quot;</span>$list<span style="color: #800000;">&quot;/ is a not using versions&quot;</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> yellow
              <span style="color: #008000;">#$list.Enableversioning = $true</span>
              <span style="color: #008000;">#$List.MajorVersionLimit = 3</span>
              <span style="color: #008000;">#$list.update()</span>
          <span style="color: #000000;">&#125;</span>
          <span style="color: #0000FF;">else</span>
          <span style="color: #000000;">&#123;</span>
              <span style="color: #008080; font-weight: bold;">Write-host</span>  <span style="color: #800080;">$iissite</span>.url $oneweb<span style="color: #800000;">&quot;/&quot;</span>$list<span style="color: #800000;">&quot;/ has versions enabled! &quot;</span>
          <span style="color: #000000;">&#125;</span>
       <span style="color: #000000;">&#125;</span> 
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/enable-versions-on-every-sharepoint-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell to enable Versioning for every list and library in a given sharepoint site</title>
		<link>http://basementjack.com/sharepoint-2/sharepointversioning/</link>
		<comments>http://basementjack.com/sharepoint-2/sharepointversioning/#comments</comments>
		<pubDate>Mon, 07 May 2012 23:13:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=458</guid>
		<description><![CDATA[This script will enable Versioning for every list and document library in a given sharepoint site. I&#8217;d originally written it to just do document libraries, but changed my mind &#8211; things like announcements and calendars are lists, and they are equally important to protect. Same with some of the default libraries like &#8220;Site Assets&#8221; Note [...]]]></description>
			<content:encoded><![CDATA[<p>This script will enable Versioning for every list and document library in a given sharepoint site.</p>
<p>I&#8217;d originally written it to just do document libraries, but changed my mind &#8211; things like announcements and calendars are lists, and they are equally important to protect.  Same with some of the default libraries like &#8220;Site Assets&#8221;</p>
<p>Note that if the script sees that versioning is already enabled, it tells you &#8211; so no harm running the script more than once.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> microsoft.sharepoint.powershell <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
<span style="color: #800080;">$web</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spweb <span style="color: #800000;">&quot;http://www.yoursharepointurl.com/sites/yoursite/&quot;</span>
<span style="color: #800080;">$lists</span> <span style="color: pink;">=</span> <span style="color: #800080;">$web</span>.lists
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$list</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$lists</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0000FF;">if</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$list</span>.EnableVersioning <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$false</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
         <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800080;">$list</span>.title <span style="color: #800000;">&quot;is a not using versions&quot;</span>
         <span style="color: #800080;">$list</span>.Enableversioning <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
         <span style="color: #800080;">$List</span>.MajorVersionLimit <span style="color: pink;">=</span> <span style="color: #804000;">5</span>
         <span style="color: #800080;">$list</span>.update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">else</span>
    <span style="color: #000000;">&#123;</span>
         <span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800080;">$list</span>.title <span style="color: #800000;">&quot; is set for up to &quot;</span> <span style="color: #800080;">$list</span>.MajorVersionLimit <span style="color: #800000;">&quot;previous versions&quot;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/sharepoint-2/sharepointversioning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Script to disable Certificate Revocation List (CRL)</title>
		<link>http://basementjack.com/uncategorized/powershell-script-to-disable-certificate-revocation-list-crl/</link>
		<comments>http://basementjack.com/uncategorized/powershell-script-to-disable-certificate-revocation-list-crl/#comments</comments>
		<pubDate>Wed, 02 May 2012 21:54:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=455</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #the following statement goes on one line set-ItemProperty -path &#34;HKCU:\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&#34; -name State -value 146944 &#160; #the following statement goes on one line also set-ItemProperty -path &#34;REGISTRY::\HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&#34; -name State [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#the following statement goes on one line</span>
<span style="color: #008080; font-weight: bold;">set-ItemProperty</span> <span style="color: #008080; font-style: italic;">-path</span> <span style="color: #800000;">&quot;HKCU:\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&quot;</span> <span style="color: #008080; font-style: italic;">-name</span> State <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #804000;">146944</span>
&nbsp;
<span style="color: #008000;">#the following statement goes on one line also</span>
<span style="color: #008080; font-weight: bold;">set-ItemProperty</span> <span style="color: #008080; font-style: italic;">-path</span> <span style="color: #800000;">&quot;REGISTRY::\HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&quot;</span> <span style="color: #008080; font-style: italic;">-name</span> State <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #804000;">146944</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">get-ChildItem</span> REGISTRY::HKEY_USERS <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">foreach-object</span> <span style="color: #000000;">&#123;</span><span style="color: #008080; font-weight: bold;">set-ItemProperty</span> <span style="color: #008080; font-style: italic;">-ErrorAction</span> silentlycontinue <span style="color: #008080; font-style: italic;">-path</span> <span style="color: #000000;">&#40;</span><span style="color: #000080;">$_</span>.Name <span style="color: pink;">+</span> <span style="color: #800000;">&quot;\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&quot;</span><span style="color: #000000;">&#41;</span>  <span style="color: #008080; font-style: italic;">-name</span> State <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #804000;">146944</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> White <span style="color: #800000;">&quot; - Disabling Certificate Revocation List (CRL) check...&quot;</span>
<span style="color: #0000FF;">ForEach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$bitsize</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;64&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> 
<span style="color: #000000;">&#123;</span>			
  <span style="color: #800080;">$xml</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span><span style="color: #008080;">xml</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Content</span> <span style="color: #800080;">$env</span>:windir\Microsoft.NET\Framework<span style="color: #800080;">$bitsize</span>\v2.0.50727\CONFIG\Machine.config<span style="color: #000000;">&#41;</span>
  <span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #800080;">$xml</span>.DocumentElement.SelectSingleNode<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;runtime&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> 
    <span style="color: #800080;">$runtime</span> <span style="color: pink;">=</span> <span style="color: #800080;">$xml</span>.CreateElement<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;runtime&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$xml</span>.DocumentElement.AppendChild<span style="color: #000000;">&#40;</span><span style="color: #800080;">$runtime</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Out-Null</span>
  <span style="color: #000000;">&#125;</span>
  <span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #800080;">$xml</span>.DocumentElement.SelectSingleNode<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;runtime/generatePublisherEvidence&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$gpe</span> <span style="color: pink;">=</span> <span style="color: #800080;">$xml</span>.CreateElement<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;generatePublisherEvidence&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #800080;">$xml</span>.DocumentElement.SelectSingleNode<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;runtime&quot;</span><span style="color: #000000;">&#41;</span>.AppendChild<span style="color: #000000;">&#40;</span><span style="color: #800080;">$gpe</span><span style="color: #000000;">&#41;</span>  <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Out-Null</span>
  <span style="color: #000000;">&#125;</span>
  <span style="color: #800080;">$xml</span>.DocumentElement.SelectSingleNode<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;runtime/generatePublisherEvidence&quot;</span><span style="color: #000000;">&#41;</span>.SetAttribute<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;enabled&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;false&quot;</span><span style="color: #000000;">&#41;</span>  <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Out-Null</span>
  <span style="color: #800080;">$xml</span>.Save<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;$env:windir\Microsoft.NET\Framework$bitsize\v2.0.50727\CONFIG\Machine.config&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/powershell-script-to-disable-certificate-revocation-list-crl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell to add all users (claims) to Sharepoint</title>
		<link>http://basementjack.com/uncategorized/powershell-allusers-claims/</link>
		<comments>http://basementjack.com/uncategorized/powershell-allusers-claims/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 16:33:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=449</guid>
		<description><![CDATA[PowerShell command to add all users via claims via PowerShell to SharePoint 1 New-spuser “c:0&#40;.s&#124;true&#34; -web http://www.mysharepointsite.com/ -permissionlevel &#34;read&#34;]]></description>
			<content:encoded><![CDATA[<p>PowerShell command to add all users via claims via PowerShell to SharePoint</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">New<span style="color: pink;">-</span>spuser  “c:<span style="color: #804000;">0</span><span style="color: #000000;">&#40;</span>.s<span style="color: pink;">|</span>true<span style="color: #800000;">&quot; -web http://www.mysharepointsite.com/ -permissionlevel &quot;</span>read<span style="color: #800000;">&quot;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/powershell-allusers-claims/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell to activate a SharePoint 2010 feature on every site collection in a web app</title>
		<link>http://basementjack.com/uncategorized/powershell-to-activate-a-sharepoint-2010-feature-on-every-site-collection-in-a-web-app/</link>
		<comments>http://basementjack.com/uncategorized/powershell-to-activate-a-sharepoint-2010-feature-on-every-site-collection-in-a-web-app/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 05:07:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=423</guid>
		<description><![CDATA[I recently was given a WSP to add to our farm. In this case after the WSP was installed and deployed we needed to activate the feature at the site collection level. Thats usually easy enough to do through the UI, but in this particular case we had a web application which had over a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was given a WSP to add to our farm.</p>
<p>In this case after the WSP was installed and deployed we needed to activate the feature at the site collection level.<br />
Thats usually easy enough to do through the UI, but in this particular case we had a web application which had over a dozen site collections.</p>
<p>ie:</p>
<ul>
<li>http://jack.com</li>
<li>http://jack.com/blog</li>
<li>http://jack.com/marketing</li>
<li>10 more like the above&#8230;</li>
</ul>
<p>Activating it at http://jack.com from the UI was fine, but when the user navigated to http://jack.com/blog they were stumbling onto another site collection, and the feature wasn&#8217;t activated there.</p>
<p>To activate it on every Site collection meant that I&#8217;d have to a) know what each site collection was, and b) visit that site, and activate the feature.<br />
<br/><br />
Too much work.<br />
<br/><br />
What was needed was a simple script that would loop though each site collection, enabling the feature on each one.<br />
<br/><br />
The script below is a result of that need&#8230;<br />
<br/></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;">&nbsp;
 <span style="color: #008000;"># this script enables a feature on every site collection on a given web app</span>
&nbsp;
 <span style="color: #008080; font-weight: bold;">Add-PSSnapin</span> microsoft.sharepoint.powershell <span style="color: #008080; font-style: italic;">-ErrorAction</span> SilentlyContinue
 <span style="color: #800080;">$webs</span> <span style="color: pink;">=</span>  get<span style="color: pink;">-</span>spsite <span style="color: pink;">-</span>webapplication <span style="color: #800000;">&quot;http://www.yoursharepointURL.com&quot;</span>
 <span style="color: #800080;">$feature</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;YourFeatureName&quot;</span> <span style="color: #008000;">#this might not be what you expect it to be, best to do get-spfeature | Select displayname</span>
&nbsp;
  <span style="color: #0000FF;">Foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$oneweb</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$webs</span><span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #800080;">$oneweb</span>
    <span style="color: #800080;">$siteFeature</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>spfeature <span style="color: pink;">-</span>site <span style="color: #800080;">$oneweb</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.displayname <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$feature</span><span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$siteFeature</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Activating Site level Features at $oneweb&quot;</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> Yellow
      Enable<span style="color: pink;">-</span>SPFeature <span style="color: pink;">-</span>Identity <span style="color: #800080;">$Feature</span> <span style="color: pink;">-</span>URL <span style="color: #800080;">$oneweb</span>.URL <span style="color: #008080; font-style: italic;">-Confirm</span>:<span style="color: #800080;">$False</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">else</span>
    <span style="color: #000000;">&#123;</span>
      <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Feature $feature is already activated on $oneweb&quot;</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> green
    <span style="color: #000000;">&#125;</span>
  <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>If you look at the simple logic, you&#8217;ll see you can run it more than once &#8211; and the second time you run it, it should display an all green list indicating that all the site collections already have the feature activated.</p>
]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/powershell-to-activate-a-sharepoint-2010-feature-on-every-site-collection-in-a-web-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Give a new Sharepoint developer the ability to run powershell commands</title>
		<link>http://basementjack.com/uncategorized/give-a-new-sharepoint-developer-the-ability-to-run-powershell-commands/</link>
		<comments>http://basementjack.com/uncategorized/give-a-new-sharepoint-developer-the-ability-to-run-powershell-commands/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 22:21:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=410</guid>
		<description><![CDATA[See who has them with get-spshelladmin add one with add-spshelladmin]]></description>
			<content:encoded><![CDATA[<p>See who has them with<br />
get-spshelladmin<br />
add one with<br />
add-spshelladmin</p>
]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/give-a-new-sharepoint-developer-the-ability-to-run-powershell-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell to test a URL against UAG rulesets</title>
		<link>http://basementjack.com/uncategorized/powershell-to-test-a-url-against-uag-rulesets/</link>
		<comments>http://basementjack.com/uncategorized/powershell-to-test-a-url-against-uag-rulesets/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 04:43:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[UAG]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=400</guid>
		<description><![CDATA[Many companies use Microsoft Forefront Universal Access Gateway (UAG) to publish sharepoint sites to the public internet. We recently had a problem where office (word, excel, powerpoint) documents would not open through a sharepoint published site Via UAG in the office app on the end users home PC. In UAG there&#8217;s a bunch of rules [...]]]></description>
			<content:encoded><![CDATA[<p>Many companies use Microsoft Forefront Universal Access Gateway (UAG) to publish sharepoint sites to the public internet.</p>
<p>We recently had a problem where office (word, excel, powerpoint) documents would not open through a sharepoint published site Via UAG in the office app on the end users home PC.</p>
<p>In UAG there&#8217;s a bunch of rules that match the URL in question via a regex.<br />
We needed a quick way to test our URL against the regex in each and every rule so we knew which rules applied.</p>
<p>There currently isn&#8217;t a way to do that in UAG (there should be)<br />
So as an alternate to doing these manually, I used the &#8220;Export rules&#8221; feature, then wrote the following powershell script to parse the exported file, gather the RegEx&#8217;s of each, and test the URL in question against each RegEx so you can see what rule is actually being applied.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;"># if you run from ISE and get a permissions error copy and paste everything to a new tab.</span>
<span style="color: #008000;"># or run get-executionpolicy (take note what it is) then run (as an administrator): set-executionpolicy unrestricted</span>
<span style="color: #008000;">#set theses two variables -</span>
<span style="color: #800080;">$ExportedRuleSetFile</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">get-content</span> <span style="color: #800000;">'c:\PS\PRD_URLset.txt'</span>
<span style="color: #800080;">$URLtoFind</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;/get/content/from/sharepoint.aspx&quot;</span>
<span style="color: #0000FF;">Function</span> FindAMatch<span style="color: #000000;">&#40;</span><span style="color: #800080;">$Rulefile</span><span style="color: pink;">,</span> <span style="color: #800080;">$URL</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$table</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.DataTable <span style="color: #800000;">&quot;RegExList&quot;</span>
	<span style="color: #800080;">$col1</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.DataColumn Section<span style="color: pink;">,</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$col2</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.DataColumn Name<span style="color: pink;">,</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$col3</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.Data.DataColumn RegEx<span style="color: pink;">,</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$table</span>.columns.add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$col1</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$table</span>.columns.add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$col2</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$table</span>.columns.add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$col3</span><span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #800080;">$row</span> <span style="color: pink;">=</span> <span style="color: #800080;">$table</span>.NewRow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$row</span>.Section <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Section&quot;</span>
	<span style="color: #800080;">$row</span>.name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Name&quot;</span>
	<span style="color: #800080;">$row</span>.RegEx <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Regex&quot;</span>
&nbsp;
	<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$line</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$Rulefile</span> <span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$line</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;[&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$table</span>.Rows.add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$row</span> <span style="color: pink;">=</span> <span style="color: #800080;">$table</span>.NEwRow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$row</span>.Section <span style="color: pink;">=</span> <span style="color: #800080;">$line</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0000FF;">elseif</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$line</span>.substring<span style="color: #000000;">&#40;</span><span style="color: #804000;">0</span><span style="color: pink;">,</span><span style="color: #804000;">7</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;m_regex&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$row</span>.RegEx <span style="color: pink;">=</span> <span style="color: #800080;">$line</span>.substring<span style="color: #000000;">&#40;</span><span style="color: #804000;">8</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0000FF;">elseif</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$line</span>.substring<span style="color: #000000;">&#40;</span><span style="color: #804000;">0</span><span style="color: pink;">,</span><span style="color: #804000;">7</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;m_name=&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$row</span>.Name <span style="color: pink;">=</span> <span style="color: #800080;">$line</span>.Substring<span style="color: #000000;">&#40;</span><span style="color: #804000;">7</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
	<span style="color: #800080;">$table</span>.Rows.add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$row</span><span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #008080; font-weight: bold;">write-host</span> Note: this only searches SharePoint Rules
	<span style="color: #008000;"># note the select statement is needed because many of the records don't have regex values</span>
	<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$record</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$table</span>.<span style="color: #008080; font-weight: bold;">select</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;name like 'SharePoint%'&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$url</span> <span style="color: #FF0000;">-match</span> <span style="color: #800080;">$record</span>.regex<span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-weight: bold;">Write-host</span> <span style="color: #800080;">$url</span> found <span style="color: #0000FF;">in</span> <span style="color: #800080;">$record</span>.name via regex matching <span style="color: #800080;">$record</span>.regex
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span> <span style="color: #008000;">#end function</span>
FindAMatch <span style="color: #800080;">$ExportedRuleSetFile</span> $URLtoFind</pre></td></tr></table></div>

<p>Sample output looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">Note: this only searches SharePoint Rules
/get/content/from/sharepoint.aspx found in SharePoint14AAM_Rule1 via regex matching (/[^&quot;#&amp;amp;*+:&amp;lt;&amp;gt;?\\{|}~]*)/?
/get/content/from/sharepoint.aspx found in SharePoint14AAM_Rule47 via regex matching (/[^&quot;#&amp;amp;*+:&amp;lt;&amp;gt;?\\{|}~]*)*/[^&quot;#&amp;amp;/:&amp;lt;&amp;gt;?\\{|}~]*\.aspx
/get/content/from/sharepoint.aspx found in SharePoint14AAM_Rule48 via regex matching /
/get/content/from/sharepoint.aspx found in SharePoint14AAM_Rule60 via regex matching (/[^&quot;#&amp;amp;*+:&amp;lt;&amp;gt;?\\{|}~]*)/?</pre></div></div>

<p>As a side note, we were able to pinpoint the rule that applied to our URL which made fixing it much easier!</p>
]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/powershell-to-test-a-url-against-uag-rulesets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharepoint 2010 ULS logs &#8211; How to keep them in SQL</title>
		<link>http://basementjack.com/uncategorized/sharepoint-2010-uls-logs-how-to-keep-them-in-sql/</link>
		<comments>http://basementjack.com/uncategorized/sharepoint-2010-uls-logs-how-to-keep-them-in-sql/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 23:32:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[ULS]]></category>

		<guid isPermaLink="false">http://basementjack.com/?p=392</guid>
		<description><![CDATA[This article shows you how to store your ULS logs in SQL]]></description>
			<content:encoded><![CDATA[<p>This is another &#8220;Wow that was easy!&#8221; SharePoint items&#8230;</p>
<p>Open Central Admin<br />
Go to the Monitoring section, then under &#8220;Timer Jobs&#8221;, select &#8220;Review job definitions&#8221;</p>
<p>There&#8217;s a timer job called &#8220;Diagnostic Data Provider: Trace Log&#8221;</p>
<p>It&#8217;s disabled by default, enable it and it will create new tables and a view on your logging database. (I think by default this is named WSS_Logging)<br />
Leave it enabled (mine is set to run every 10 minutes)</p>
<p>Open SQL server Management studio and connect to your sharepoint DB server.<br />
expand the WSS_Logging DB<br />
Expand Views<br />
Look for the new view called &#8220;ULSTraceLog&#8221;</p>
<p>I usually right click on the view name and &#8220;Select Top 1000 Rows&#8221;<br />
Then from there I can add a where clause to the query thats on screen,<br />
most often it&#8217;s<br />
WHERE CorrelationID = &#8216;abcd-efg-hijk-lmnop-qrstuv&#8217;</p>
<p>Another tip- in the results (which on my system default to the &#8220;grid&#8221; view),<br />
Right Click, Select All, then<br />
Right Click, Copy with headers<br />
you can then paste this into Excel and it&#8217;s pretty readable if you need to email it to someone.</p>
<p>As a side note, I&#8217;ve enabled this on a handful of farms and it seems to auto trim the DB sizes &#8211; so you don&#8217;t need to worry about the DB filling up over time.</p>
]]></content:encoded>
			<wfw:commentRss>http://basementjack.com/uncategorized/sharepoint-2010-uls-logs-how-to-keep-them-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

