So excited! I got it to work! This is the full script, I cannot post my work's data path's up here so I changed them out, if they look a little funny....#Data Replacement, by: rangermry
#3/13/2012
#Script to replace data sources in a MXD
#Written using Python 2.6.5 and the ArcGIS Desktop 10.0 ArcPy Mapping Module.
#This script makes a new SDE connection file on the user's C Drive and then replaces the old server's paths in the MXD with the new
#connection file.
#Import Python Libraries
import arcpy, os
#Set Your Variables Up Here!
# Must add prefix r (stands for raw) and put path in quotes.
targetMXD = r"\\servername\mxdpath\.mxd"
userName = "rangermry"
# Set variables for creating new SDE Connection
folderName = "C:/Documents and Settings/" + userName + "/Application Data/ESRI/Desktop10.0/ArcCatalog"
fileName = "Connection to Server.sde"
serverName = "SERV1"
serviceName = "5151"
databaseName = "gis"
authType = "DATABASE_AUTH"
username = "local"
password = "local"
saveUserInfo = "SAVE_USERNAME"
versionName = "SDE.DEFAULT"
saveVersionInfo = "SAVE_VERSION"
#Process: Use the CreateArcSDEConnectionFile function
rcpy.CreateArcSDEConnectionFile_management(folderName, fileName, serverName, serviceName, databaseName, authType, username, password, saveUserInfo, versionName, saveVersionInfo)
mxd = arcpy.mapping.MapDocument(targetMXD)
for df in arcpy.mapping.ListDataFrames(mxd):
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.supports("SERVICEPROPERTIES"):
servProp=lyr.serviceProperties
#Replace old dataset name with new dataset name and replace
if (lyr.serviceProperties["ServiceType"]=="SDE") and (lyr.serviceProperties["Service"]== "5153"):
dataSet=lyr.dataSource
list=dataSet.split('\\')
newDataSet=str(list[2])
currentName=newDataSet.split('.')[0]
newDataSet=newDataSet.replace(currentName,username)
newDataSetName=newDataSet.split('.')[0]
sdeFile="Database Connections\\"+fileName
lyr.replaceDataSource(sdeFile,"SDE_Workspace",lyr.name,"")
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
mxd.save()
del mxd