Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing csnw 1

Status
Not open for further replies.

ummyeah

MIS
Mar 21, 2006
15
US
i am a long time admin, scripting newbie.

Someone please tell me that I can remove CSNW (client services for Netware) via a script. I would hate for migration to get prolonged only because i have to manually remove from every workstation.


any advice would be greatly appreciated.

Thanks in advance

Mo
 
Thank you for your reply!

This article is intended for NT4 systems..

I have a mixture of 2k-XP systems.

Should it matter?

thanks!

 
I cant seem to find netcfg.exe on my 2003 server. Maybe Im crazy. could you help me locate it?

Thanks,

Mo
 
Thank you,

Actually I downloaded the oem system builder (WindowsPE Sp2) which contained the netcfg.exe while the resource kit did not. I've actually got the script done, and now (somehow) i am having trouble running it via System Startup using GPO.

*sigh*

if it aint one thing, its another.


Thanks again,

Mo
 
Ok, so I've gotten this script to work locally (like a charm) but for some reason I can not get it going in group policy. I have it linked to an OU for system startup. below is the script. Can someone advise me as to why it isnt working?


thanks

Mo


<<<<<<<<<<<<<<<<<<<<<<SCRIPT>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Set w = WScript.CreateObject("WScript.Shell")
Set objShell = WScript.CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colServices = objWMIService.ExecQuery _
("SELECT * FROM Win32_Service")

For Each objService In colServices
If objService.Name = "NWCWorkstation" Then
w.Popup "The Novell client will now be removed from your computer. " & vbCrLf & "When it has completed, your computer will automatically reboot.", 10, "Novell Client Removal", 48
objShell.Run("\\crcfs01\templates\csnw\Netcfg.exe -v -u MS_NWCLIENT"),1,True
End If
Next

w.Popup "Your computer will now be rebooted. " & vbCrLf & "After the reboot, you may resume working normally.", 5, "Rebooting!", 48

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Shutdown)}!\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")

For Each objOperatingSystem In colOperatingSystems
objOperatingSystem.Reboot()
Next


<<<<<<<<<<<<<<<<<<<<<<<<<<<END SCRIPT>>>>>>>>>>>>>>>>>>>>>
 
Could it be that the gpo isnt running because the .vbs has pop-ups for user interaction??


Thanks,

Mo
 
Sure you don't want user interactive for a startup script.
 
Thanks!


So, I am a scripting idiot. Do you think you could help me remove the popup prompt so I can finally remove CSNW from all these darn workstations! :)

It would be greatly appreciated


Thanks

Mo
 
Try these changes.
[1][tt]
If objService.Name = "NWCWorkstation" Then
[red]'[/red]w.Popup "The Novell client will now be removed from your computer. " & vbCrLf & "When it has completed, your computer will automatically reboot.", 10, "Novell Client Removal", 48
objShell.Run("\\crcfs01\templates\csnw\Netcfg.exe -v -u MS_NWCLIENT"),[red]0[/red],True
End If
[/tt]
[2]
[tt][red]'[/red]w.Popup "Your computer will now be rebooted. " & vbCrLf & "After the reboot, you may resume working normally.", 5, "Rebooting!", 48
[/tt]
[3][tt]
For Each objOperatingSystem In colOperatingSystems
objOperatingSystem.[red]win32shutdown(6)[/red]
Next
[/tt]
 
I had done some searching and found the code below. It uses Netware's own uninstall method and also puts the msgina back to the original value. I am not sure but it looks like with yours the netware is still there, just not bound. (I could be wrong.)

I found this code online - don't remember where but author is in comments. I added a couple of items for our environment.
Code:
' *********** Start Code ***********

' Script that removes Novell NW Client 4.x "silently"
' Tested on NW Clent version 4.8 and Win2000
' NT 4.0 without WMI installed will have a problem
' with the DeleteRegistryKey Sub routine.

' Author: Torgeir Bakken

rem ***** test to see if this script has already run before on this computer
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

outputfile = "C:\NWREMOVE.TXT"
If oFSO.FileExists(outputfile) Then Wscript.Quit

set WSHNetwork = wscript.CreateObject("WSCript.Network")
If oFSO.FolderExists("J:\") then WsHNetwork.RemoveNetworkDrive "J:", true
WSHNetwork.MapNetworkDrive "J:", "\\pdmis-docs\sys", False

'MsgBox "This script will un-install the NetWare client software from your Windows NT or Windows 2000 workstation." & vbCrLf & _
'       "The last screen will display a message that the 'The installation was not completed successfully.'" & vbCrLf & _
'       "This message is normal and does not mean that anything is broken. " & vbCrLf & vbCrLf & _
'       "At the end of the un-install script a message will be displayed asking you to reboot your workstation." & vbCrLf & _
'       "Please reboot at that time to insure that you do not lose your connection to the network." & vbCrLf & vbCrLf & _
'    "If you have any questions or problems with these instructions, please call System Support, ext 3524."

' On NT-based OS's, RegDelete can't delete a key if there exists subkeys
' Using WMI instead, see seperate Sub DeleteRegistryKey(hive,key)
' (WMI is preinstalled on Win2k/WinXP/WinME, can be installed on NT4/Win9x)
Set oRegistry = GetObject("winmgmts:root/default:StdRegProv")
Const HKCR = &H80000000 'HKEY_CLASSES_ROOT
Const HKCU = &H80000001 'HKEY_CURRENT_USER
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006

' From Novell TID2948079
' Unattended Remove of the NT Client
' [URL unfurl="true"]http://support.novell.com/cgi-bin/search/searchtid.cgi?/2948079.htm[/URL]

' J:\NWClient48\i386\ is the NW Client install source (full package)
' J:\NWClient48\CleanUp\NWUninst.ini is the unattend file
' They can be placed on the network, you should not be disconnected
' from the server during or after install.
' You must do a reboot before the connection is lost.
' WMI can be used to start the reboot :-)

' NB! No spaces in the path is allowed (if you change the path)
sNwclntCmd = "J:\NWC\i386\setupnw.exe /U:J:\NWC\NWUninst.ini"

' Starting the uninstall!
oShell.Run sNwclntCmd, 1, True

' From Novell TID10013922 and then some
' [URL unfurl="true"]http://support.novell.com/cgi-bin/search/searchtid.cgi?/10013922.htm[/URL]

' This is _very_ important, GinaDLL is critical to get right!
sGinaPath = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon\GinaDLL"

oShell.RegWrite sGinaPath, "MSGINA.DLL"

DeleteRegistryKey HKLM, "SOFTWARE\Novell"
DeleteRegistryKey HKLM, "SYSTEM\CurrentControlSet\Services\NetWareWorkstation"
DeleteRegistryKey HKLM, "SYSTEM\CurrentControlSet\Control\Print\Providers\Netware Print Services"
DeleteRegistryKey HKLM, "SYSTEM\CurrentControlSet\Control\Print\Providers\Novell Distributed Print Services"
DeleteRegistryKey HKCU, "SOFTWARE\NetWare"

' You can use Netset.exe from the Win2000 Resource Kit to remove any
' IPX protocol if necessary, among other things:

' Netset.exe is a standalone utility that you can use to add,
' remove, or change the network configuration of a client
' computer that has Windows 2000 already installed on it.
' For example, you can use this tool to remove a protocol,
' such as Internetwork Package Exchange (IPX) or NetBeui,
' from a client that is no longer used on your network.
' You can also use this tool to change the Internet
' Protocol (IP) information on a group of servers or
' workstations without using the user interface.

' More at:
' Description of the Netset.exe Tool from the Windows 2000 Resource Kit (Q268781)
' [URL unfurl="true"]http://support.microsoft.com/default.aspx?scid=kb;en-us;Q268781[/URL]

' I have not tried this myself, so I have no IpxRemove.ini to offer ;-)
' Because of that, the two lines below are commented out.

' sNetSetCmd = "J:\NWClient48\CleanUp\NetSet.exe J:\NWClient48\CleanUp\IpxRemove.ini"
' oShell.Run sNetSetCmd, 0, True

'msgbox "Please reboot your computer now."

Set f = oFSO.OpenTextFile(outputfile, ForWriting, True)
f.Writeline ("Novell Client Removed " & date & " " & time)
f.Close

oShell.Run "shutdown -r -t 5"

Sub DeleteRegistryKey(hive,key)
  On Error Resume Next
  rc = oRegistry.EnumKey(hive,key,arSubKeys)
  For Each sKey In arSubKeys
    If Err Then
      Err.Clear
      Exit Sub
    End If
    DeleteRegistryKey hive, key & "\" & sKey
  Next
  rc = oRegistry.DeleteKey(hive,key)
End Sub

' *********** End Code ***********
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top