Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (8/6/10)

Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (8/6/10)

  • Comments 2
  • Likes

In this post:

 

How Can I Transfer a Folder from Novel Netware to Windows Server 2008?

Hey, Scripting Guy! Question

 Hey, Scripting Guy! I need your help to find a script to transfer a folder from Novel Netware (Version 6.5 OEM) to Windows Server 2008.

The scenario goes like this: I have a Novell Server which consists of two volumes. On one volume, I have a folder with user accounts and password information. I want to transfer this folder to Windows Server 2008 so that it can access details on the other volume of the Novel Netware Server. Please could you provide me with the appropriate details?
 

-- AA

 

Hey, Scripting Guy! AnswerHello AA,

Microsoft Scripting Guy Ed Wilson here. In the past we used to have what was called “Services for Netware” that would provide for Netware/Microsoft integration. I know that product is now discontinued. In Windows 2000, there was a Netware/Microsoft migration tool that would bring over users, folders, and permissions, but that wizard has also been discontinued. I believe there are third party tools that play in this space. In addition, I believe you may be able to do something with CIFS and provide some level of interoperability, but I am not an expert in this arena any longer. It has been more than a decade since I have performed any Netware administration or migration. I remember it was a lot of fun.

Anyway, there are no scripts or secrets involved here. If you can find something to integrate with security between the two systems, any script that copies files and folders will work. As an aside, you might consider setting up a SharePoint site to share files and folders. This would provide a high degree of interoperability between the two systems. SharePoint has an API you could program against to upload and download files. SharePoint 2010 has some awesome Windows PowerShell cmdlets to provide for ease of administration.

 

 

 

Why Can't I Run This Script You Guys Wrote?

Hey, Scripting Guy! Question

  Hey, Scripting Guy! I believe there is an error in How Can I Delete a Folder and All Its Subfolders? I am running Windows 7 Professional 64 bit, and I am using the script from the above link to delete folders in my temp folder. It works fine unless one of the folders starts and ends with { and }. I receive error 0x80041017, code 80041017, source null, on Line 28. That is the line in the long version that is supposed to work in any version of Windows. Line 28 is the For statement in Sub GetSubFolders. If I first remove the folder with the curly brackets, the script works fine.

Any ideas about how to fix this?

-- CH

 

Hey, Scripting Guy! AnswerHello CH, 

I believe you are running into a problem with a special charactera difference between WMI and Windows itself. The "best" thing is to not use these types of characters in your file names (I do not even like spaces) because they invariably cause problems somewhere along the way in a script or at the command line. However, here are a couple resources that may help. The first is a Quick Hits Friday article. The second one is the article that is referred to. Essentially, you will need to escape your curly brackets.

 

  

How Can I Clear an Attribute in Active Directory?

Hey, Scripting Guy! Question

  Hey, Scripting Guy! I ran into an interesting problem over the last few days in my Windows 2008/Exchange 2007 forest. A third-party entity migrated more than 700 accounts to a new forest and mistakenly migrated the msExchMasterAccountSid attribute. Exchange uses the value or lack thereof of this attribute to determine if the mailbox is linked to an account in the local forest or an external one. If it's populated, it's an externally associated account and Exchange uses the msExchMasterAccountSid; if it's not populated, Exchange uses the ObjectSid attribute. Both attributes are exactly the same type. The issue I ran into was when I tried to clear the msExchMasterAccountSid.

In short, I tried VBScript and ADSI using the put/putex methods, and tried to set the attribute to null using Exchange specific mailbox cmdlets from Windows PowerShell. Of course, it works like a charm if I just use ADSIEdit and the Clear button on the attribute. How's that for a challenge?

By the way, in older versions of Exchange there were tons of tools that dealt with MAS issues, but not so in pure Exchange 2007 environments. Not even CDOEXM is available. Most utilities that previously existed are now replaced with Windows PowerShell cmdlets. What do you think? Good content for an article of some sort? Folks run into this issue in cross-organizational moves, so you'd be helping me out and the population at large as well.

-- JI

 

Hey, Scripting Guy! AnswerHello JI,

I think what you are saying is that you want to clear an attribute in Active Directory? The msExchMasterAccountSid is shown in ADSI Edit in the following image.

Image of msExchMasterAccountSid in ADSI Edit

 

Here is a VBScript script I wrote a few years ago that clears the value from an attribute in Active Directory. I do not have a Windows PowerShell version yet.

RemoveUserProperties.vbs

'==========================================================================

'

'

' NAME: <RemoveUserProperties.vbs>

'

' AUTHOR: Ed Wilson , MS

' DATE  : 4/28/2006

'

' COMMENT: <Uses PutEx method and sets the ADS_PROPERTY_CLEAR constant>

'1. uses PutEx method from IADs interface.

'2. If no value is assigned to the attribute, then remove ignored.

'3. The adRemove is actually an ADS_PROPERTY_OPERATION_ENUM  value.

'4. When this is specified, then the third parameter for PutEx is ignored.

'5. It must be present, but vProp is ignored.

'==========================================================================

Option Explicit

Dim provider 'defines how will talk.

Dim ou ' path to where new object will be created

Dim domain 'name of domain connecting to

Dim oCN 'name of object are creating

Dim oUname 'User name

Dim objUser 'holds connection to adsi

 

Const intRemove = 1 'ADS_PROPERTY_CLEAR constant value.

Const intBogus = 0 'This value for PutEx is ignored when using propertyClear

provider = "LDAP://"

OU = "ou=mred,"

domain = "dc=nwtraders,dc=msft"

oCN = "CN="

oUname = "myUser111,"

 

Set objUser = GetObject(provider & oCN & oUname & OU & domain)

WScript.Echo provider & oCN & oUname & OU & domain ' debug info

 

objUser.PutEx intRemove, "description", intBogus

objUser.SetInfo

 

If Err.Number = 0 then

WScript.Echo("User " & oUname & " was modified")

Else

WScript.Echo "an error occurred. it was: " & Err.Number

End if

 

The trick is to ensure you are using the ADS_PROPERTY_CLEAR enum value when calling the PutEx method.

Well, this concludes another edition of Quick-Hits Friday. Join us tomorrow for the Weekend Scripter as we delve into the mysteries of Windows 7 process startup times. We would love for you to follow us on Twitter and Facebook. If you have any questions, send email to us at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

 

Ed Wilson and Craig Liebendorfer, Scripting Guys

 

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • i used this code to clear the 'mail' address that had been set on some Group objects. They were interferring with Instant Messaging (Communicator) messages.

    Where the "$DN" is the distinguished name of the Group object.

         [string] $strGroupfqdn = $DN

         $strMygrp = [ADSI]"LDAP://$strGroupfqdn"

         $strMygrp.PSBase.Properties.mail.clear()

         $strMygrp.PSBase.CommitChanges()

    hope that helps.

  • thanks