Avinstallere CCM klienten

Dersom du har fått installert System Center Configuration Manager klienten på en maskin som ikke skal/bør ha slik klient, feks. på et databasecluster, kan det være greit å kunne fjerne den igjen. Først kan det være en ide å sjekke om den faktisk er installert. Den ligger nemlig ikke i legg til/fjern programmer, men man kan lett identifisere den ved å se etter tjenesten SMS Agent Host:

image

For å fjerne den igjen kjøres følgende kommando i et elevated command prompt:

ccmsetup.exe /uninstall

Hvor denne filen ligger er dog en annen sak. Det avhenger av hvordan CCM er installert, og hva slags OS man har. På 32bit er det vanligvis en mappe kalt %SYSTEMROOT%\System32\CCMSetup, på 64 bit os kan det variere litt, men vanligvis en av følgende:

  • %SYSTEMROOT%\System32\CCMSetup
  • %SYSTEMROOT%\CCMSetup
  • %SYSTEMROOT%\SysWOW64\CCMSetup

Om man ikke finner den kan man referere til et nettverksshare på CCM serveren. Hva det heter må få fra de ansvarlige for løsningen (dersom det ikke er en selv), eller man kan være utspekulert søke opp filene selv Winking smile

List MAC-address for wired ethernet cards

The script tries to identify wired network cards and list the mac address(es) to a file. By default it creates one file in the current directory per computer name, but you can change it to write everything to one large file. This can lead to write locks if you try to run the script at login, but if you let it run for a couple of days you should get most of them. The script was created to aid in importing computers into MS CCM collections. The idea was to put the script on a flashdrive, run around to all the computers being added and run the script manually. This was to make sure that every computer was logged.

Please note: Disabled or disconnected ethernet cards are not listed, so make sure the card for which you want the mac address is connected and enabled when you run the script.

 

 

'***************************************************************************
'** List LAN MAC addresses and output them to a file named [Computername] **
'** Output format tailored for CCM (csv): ComputerName, , MAC, CardName   ** 
'**                             Jan Kåre Lokna                         **
'***************************************************************************
option explicit
on error goto 0

'Get computername for filename.
Dim wshShell
Set wshShell = WScript.CreateObject( "WScript.Shell" )
Dim strFilename
strFilename = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) 'change this to a filename on a network share if you want to use a common file for all computers, e.g strFilename="\\server\share\filename.txt"

'Get cards from WMI
Dim objWMIService
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") 
Set colItems = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapter where MACAddress != null AND AdapterTypeID like '0'") 
'Create / open file
Dim fso
Dim objFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(strFilename) Then
	Set objFile = fso.CreateTextFile(strFilename)
Else
	Set objFile = fso.OpenTextFile(strFilename, ForReading, True)
	Dim strReadFile
	strReadFile = objFile.ReadAll
	objFile.Close
	Set objFile = fso.OpenTextFile(strFilename, ForAppending, True)
  End If
'Process cards
Dim colItems
Dim objItem
For Each objItem in colItems 
	Dim strMAC
	strMAC = objItem.MACAddress
	Dim strName 
	strName = objItem.Name
	'Check for bluetooth or wifi
	If InStr(strName, "Bluetooth") > 0 Then
		'Do nothing
	ElseIf InStr(strName, "WiFi") > 0 Then
		'Do nothing
	else
		'Format output
		Dim strInfo
		strInfo = objItem.SystemName & ", " & "," & strMAC & "," & strName
		wscript.echo strInfo
		'write file
		'Check if MAC exists in file
		If InStr(strReadFile, strMAC) = 0 Then
			'if not, then append to file
			objFile.WriteLine strInfo
			wscript.echo (strMAC & " written to " & strFileName)
		 End If
	 end if
Next
'Close file
objFile.Close