While messing around with Azure trying to familiarize myself with it, I created a VM and tried to connect to it.

For those familiar with RDP, it uses TCP port 3389 and my company firewall blocks that, outgoing.

The nice thing is, you can change the Public Endpoint your VM uses from 3389 to any port you know your company DOES allow.  In my case, I know that port 80 and 443 are allowed outbound, so, I changed my public Endpoint to 443.

The steps to do this:

  1. Log into the Azure Portal and select the virtual machines in the left navigation window
  2. Click on the VM for which you want to modify the endpoint
  3. Click the “ENDPOINTS” link at the top of the main window
  4. Click the “EDIT ENDPOINT” at the bottom of the window
  5. Under “PUBLIC PORT”, type the new port you want to use and click the Check Mark in the bottom right of the “Edit endpoint” window
  6. Navigate back to virtual machines list and, with your VM highlight, click connect and it will pass the new RDP settings for the new RDP session (now using the new tcp port for endpoint you specified)
Advertisements

PowerShell Compare two files

September 12, 2012

Open PS console

$a = <file number 1> (i.e. $a = \\server1\d$\inetpub\wwwroot\app\web.config)

$b = <file number 2> (i.e. $b = \\server1\d$\inetpub\wwwroot\app\web.config1)

Compare-Object $a $b

Produces the following:

To remove the “…” so you can see the entire output, you can use the –expandproperty and have the output only show the inputobject

    Compare-Object $a $b | select inputobject

The send the output to a text file you can do the following:

Compare-Object $a $b | select -ExpandProperty inputobject | Out-File c:\logs\configdiff.txt

Run the SQL server cliente network utility (cliconfg.exe)

NOTE: There are two versions of the cliconfg.exe and the aliases should be set up in both. In order to launch the 32-bit version of cliconfg, it has to be run from the folder it’s in. The path to this file is %SystemDrive%\Windows\sysWOW64\cliconfg.exe.

To set up the aliases:

  1. Under the general TAB, add TCP/IP in the “Enabled protocols by order:”

  2. Select “properties” button and add the correct TCP/IP port that SQL is listening for on the backend (see the table above):

  3. Click OK
  4. Select the Alias Tab
  5. Add the aliases needed, but, make sure to uncheck the “dynamically determine ports” and add the correct TCP/IP port that SQL is listening for on the back end.

Background: I need to aggregate all the events that occurred in a specified time period from both the application and system logs from two load balanced WFEs on production SharePoint.

NOTE: Export-CSV does not allow you to append to an already existing CSV file. However, Dimitry Sotnikov created a replacement function for “export-csv” that does allow for the “-append” parameter.

Once you load the export-csv function, you can proceed with the following steps to gather log information from multiple servers:

  1. Perform the following steps on first WFE:
    1. To get all events from the application log between a date/time period (In this case, between 9:15AM and 7PM on 8-9-2012) and append them to a log file named applog.csv:

      get-eventlog -logname application -after “8-9-2012 09:15:00” -before “8-9-2012 19:00:00” | export-csv e:\export\applog.csv –append

    2. Get all events from system log between date/time period (in this case, between 9:15AM and 7PM on 8-9-2012) and append them to a log file named applog.csv:

      get-eventlog -logname system -after “8-9-2012 09:15:00” -before “8-9-2012 19:00:00” | export-csv e:\export\applog.csv –append

  2. Perform the following steps on the second WFE:
    1. Copy the applog.csv from \\WFE01\E$\export to e:\export on WFE02
    2. Get all events from application log between date/time period (in this case, between 9:15AM and 7PM on 8-9-2012) and append them to a log file named applog.csv:

      get-eventlog -logname application –after “8-9-2012 09:15:00” –before “8-9-2012 19:00:00” | export-csv e:\export\applog.csv –append

    3. Get all events from system log between date/time period (in this case, between 9:15AM and 7PM on 8-9-2012) and append them to a log file named applog.csv:
      1. get-eventlog –logname system –after “8-9-2012 09:15:00” –before “8-9-2012 19:00:00” | export-csv e:\export\applog.csv –append
  3. Now you can open excel on your workstation, open the applog.csv from \\WFE02\E$\export and began cleaning up the data and sorting all events as you need to.

 

Run Query Analyzer and paste in the following code and select the database you want to query:

SELECT COUNT(*)

FROM Docs INNER JOIN Webs On Docs.WebId = Webs.Id

INNER JOIN Sites ON Webs.SiteId = SItes.Id

WHERE

Docs.Type <> 1 AND (LeafName NOT LIKE ‘%.stp’)

AND (LeafName NOT LIKE ‘%.aspx’)

AND (LeafName NOT LIKE ‘%.xfp’)

AND (LeafName NOT LIKE ‘%.dwp’)

AND (LeafName NOT LIKE ‘%template%’)

AND (LeafName NOT LIKE ‘%.inf’)

AND (LeafName NOT LIKE ‘%.css’)

How to find which w3wp.exe belongs to which application pool

If you notice, in Task Manager, there is no way of know to which app pool a work process belongs to:

But, you can get the Process ID (PID) for a worker process. And, from that, we can get the app pool to which it belongs.

NOTE: If you don’t see the PID column in task manager, you can add it by doing the following:

  1. Click on “view” drop down menu
  2. Click “select columns…”
  3. Place a check in the box next to PID (Process Identifier).
  4. Click OK

To view the application pools your worker processes belong to:

  1. Open a command prompt
  2. Navigate to c:\windows\system32
  3. Type in the following command:

    Cscript iisapp.vbs

    You should see a list of your app pools with the process ID listed next to it:

     

For more information on iisapp.vbs, you can go to

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/b8721f32-696b-4439-9140-7061933afa4b.mspx?mfr=true

About a week ago, some users of ours were complaining of very slow response time when using the “peoplepicker” to add users to access a SharePoint document library.

Upon further investigation, we found an entry in the ULS log regarding “exception when resolve principal <username> from domain <a recent domain trust that was set up>. Exception: “the server is not operational…”

Turns out that an active directory domain of a company that we recently acquired was added as a trust.

Found an article that describes what can happen with domain trusts and the Sharepoint people picker, here.

Created two powershell scripts to help me resolve the problem, once we were able to determine that we did not need to be looking into that other “trusted” domain for people picker search.

The commands that have to be run are:

    Stsadm –o setproperty –url <web application URL> -pn peoplepicker-distributionlistsearchdomains –pv <domain name>

    Stsadm –o setproperty –pn peoplepicker-searchadforests –pv domain:<domain name> -url <web application URL>

The first script I put together allows me to get all the site collection URLs that I need to apply the commands to. NOTE: the commands only need to be run at the web application URL level. But, I already had a script that would return all URLs for all site collections. And, I tested my script to see if there was any harm running the command several times on the same root URL and there was none.

Here is the first script that outputs the urls to a text file with the servername as a name of the file.

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) > $null

$ServerName = gc env:computername

$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local

$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}

$webapps = @()

foreach ($websvc in $websvcs) {

foreach ($webapp in $websvc.WebApplications) {

if ($webapp.Name -notmatch “MySite”) {

foreach ($site in $webapp.Sites) {

$site.URL >> “$servername.txt”

}

}

}

}

Second script reads the results of the first script and applies to the stsadm peoplepicker command to each URL.

$webapps = Get-Content “<insert the servername of the server the first script was run on here>.txt”

ForEach($webapp in $webapps) {

$webapp

cmd /c (“stsadm -o setproperty -url `”$webapp`” -pn peoplepicker-distributionlistsearchdomains -pv <insert your domain name here>”)

cmd /c (“stsadm -o setproperty -pn peoplepicker-searchadforests -pv domain:<insert your domain name here> -url `”$webapp`””)

}

 

I hope this helps someone out. It helped me.

  1. Go to Library you wish to place shortcut
  2. Go to Document Library Settings
  3. Go to Advanced Settings
  4. Select Allow management of content types? Yes.
  5. Click OK
  6. Scroll to the Content Types Section
  7. Click Add from existing site content types
  8. In the “Available Site Content Types:” select “Add a Link to Document
  9. Now back in your Document Library, New will have a New Link, and you just place title and URL.

After installing service pack 1 on Server 2008 R2 or Windows 7, the OS backs up all files that it replaces. This is done so you can uninstall the service pack at any time.

If you are comfortable, after having SP1 installed for a while, and you are sure you are not going to need to uninstall SP1, you can remove the backed up files and reclaim disk space by using the following steps:

  1. Open a command prompt with administrative privileges
  2. Type the following command:

    Dism /online /cleanup-image /spsuperseded

Error message when you start a PXE client to connect to a WDS server on a Windows Server 2003 SP1-based computer: “WdsClient: An error occurred while starting networking”

When you start a Pre-boot execution environment (PXE) client to connect to a Microsoft Windows Server 2003 Service Pack 1(SP1)-based computer. This computer is running Windows Deployment Service (WDS). In this scenario, you receive an error message that resembles the following:

“WdsClient: An error occurred while starting networking: a matching network card driver was not found in this image. Please have your Administrator add the network driver for this machine to the Windows PE image on the Windows Deployment Services server.”

This issue occurs if the WDS boot image does not contain a network driver for your third-party network adapter.

MY RESOLUTION

NOTE: This was done on a WDS Server running on Windows Server 2003

Download the network driver that is missing from the WDS boot image.

NOTE: In my case, the laptop was a Latitude E6410.

  • Went to Dell’s support site and found the latest Intel drivers and downloaded.
  • Extracted the drivers into a folder and found the x86 windows 7 drivers folder. The file I was looking for was the *.inf file.
  • But, I went ahead and copied all the drivers to a drivers folder on snsuwds01 under e:\drivers.

Update the WDS boot image to include the new third-party network driver.

NOTE: The following procedure assumes that the Windows Automated Installation Kit (AIK) is installed on the WDS server. If the Windows AIK is not installed on the WDS server, you can perform the same procedure on another computer that does have the Windows AIK installed. Then, map a network drive to the WDS server.

  1. On the WDS server, click Start, click Run, type wdsmgmt.msc, and then press O K .
  2. Under your WDS server, double-click Boot images.
  3. Right-click the boot image that you want, and then click “Disable”
  4. Right-click the same boot image, click “Properties”, and then click “General”
  5. Note the name the boot image that is displayed in the File name box.
  6. At a command prompt, type the following:

    C:\program files\windows aik\tools\petools\copype.cmd x86 c:\windowspe-x86

     

    NOTE: I had to manually create c:\windowspe-x86

  7. Next, type the following:

    Imagex /info e:\remoteinstall\ boot\x86\images\boot.wim

     

    NOTE: boot.wim is the filename from step 5

  8. Note the boot index number of the bootable image that is displayed. To identify the boot index number, locate the line that contains “boot index:X.”

     

    Note: X is the boot index number. The number indicates that image number X is marked as bootable and that the image is to be updated. The second image is the default image that you would typically modify. However, always verify which image is marked as bootable.

  9. Navigate to c:\windowspe-x86
  10. At a command prompt, type the following:

    imagex /mountrw e:\remoteinstall\boot\x86\boot.wim 2 mount

    NOTE: This will create a “mount” directory under c:\windowspe-x86

  11. Type the following at a command prompt:

    C:\Program Files\Windows AIK\Tools\Servicing\dism.exe /image:c:\windowspe-x86\mount /Add-driver /driver:e:\drivers\e6410\intelNIC\Windows7-x86\E1K6232.inf

     

    NOTE: e:\drivers\e6410\intelNIC\Windows7-x86\E1K6232.inf is the driver for the NIC for the Dell Latitude e6410 I had to download from Dell’s driver site

  12. Type the following at a command prompt:
    1. Imagex /unmount /commit mount
  13. Enable the boot image on the WDS Server by going back into WDS and right mouse clicking the boot image modified earlier and selecting “enable”