Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Need .CMD script module

Reply
Thread Tools Display Modes

Need .CMD script module

 
 
David H. Lipman
Guest
Posts: n/a

 
      06-16-2010
Using SharePoint.
It doesn't like '.' in Usernames such as; David.H.Lipman and converts them to '_' so in
SharePoint MySites the user name is; David_H_Lipman

Need a .CMD script snippet that will take %USERNAME% and convert it to a string with '_'
replacing all occurances of '.' within the Active Directory Username.



--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp


 
Reply With Quote
 
 
 
 
Michael Bednarek
Guest
Posts: n/a

 
      06-17-2010
On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
microsoft.public.windows.server.scripting:

>Using SharePoint.
>It doesn't like '.' in Usernames such as; David.H.Lipman and converts them to '_' so in
>SharePoint MySites the user name is; David_H_Lipman
>
>Need a .CMD script snippet that will take %USERNAME% and convert it to a string with '_'
>replacing all occurances of '.' within the Active Directory Username.


This is what I used on a similar occasion:
SET MyUsername=%@REPLACE[.,_,%USERNAME]
with 4NT as command processor; I believe 4NT now succeeded by "Take
Command", which includes the free TCC/LE.

I guess it's possible to do it with CMD, but less concisely and clearly.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
David H. Lipman
Guest
Posts: n/a

 
      06-17-2010
From: "Michael Bednarek" <ROT13->

| On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
| microsoft.public.windows.server.scripting:

>>Using SharePoint.
>>It doesn't like '.' in Usernames such as; David.H.Lipman and converts them to '_' so
>>in
>>SharePoint MySites the user name is; David_H_Lipman


>>Need a .CMD script snippet that will take %USERNAME% and convert it to a string with
>>'_'
>>replacing all occurances of '.' within the Active Directory Username.


| This is what I used on a similar occasion:
| SET MyUsername=%@REPLACE[.,_,%USERNAME]
| with 4NT as command processor; I believe 4NT now succeeded by "Take
| Command", which includes the free TCC/LE.

| I guess it's possible to do it with CMD, but less concisely and clearly.


4NT ? Hmmm, that's in the JP Software family of interpreters such as 4DOS which was
OEM'd to Norton and was called NDOS ?

It was great but... It is not a viable option on our Active Directory Domain.

The CMD.EXE, .CMD, batch processor is what I may only be able to use :-(

The objective would be such as I can eventually do...

net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\Firstname_Last name

or

net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\Firstname_MI_L astname

Where aall the Domain Accounts use the naming convention; Firstname.MI.Lastname or
Firstname.MI.Lastname

Personally I'd much rather use the latest version of KiXtart. I have already written, and
tested, a KiXtart script. However our central IS group is in a time warp and is using
KiXtart v3.60 that is (believe it or not) 11 years old! I have to write a letter of
justification of upgrading the KiXtart interpreter on the Login Server to the latest
version and can only "hope" they will do it. If that fails, I need a fall back position
which would be using the .CMD batch interpreter of Vista.


--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp


 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a

 
      06-17-2010
On Wed, 16 Jun 2010 21:23:36 -0400, David H. Lipman wrote in microsoft.public.windows.server.scripting:

>From: "Michael Bednarek"
>
>| On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
>| microsoft.public.windows.server.scripting:
>
>>>Using SharePoint.
>>>It doesn't like '.' in Usernames such as; David.H.Lipman and converts them to '_' so
>>>in
>>>SharePoint MySites the user name is; David_H_Lipman

>
>>>Need a .CMD script snippet that will take %USERNAME% and convert it to a string with
>>>'_'
>>>replacing all occurances of '.' within the Active Directory Username.

>
>| This is what I used on a similar occasion:
>| SET MyUsername=%@REPLACE[.,_,%USERNAME]
>| with 4NT as command processor; I believe 4NT now succeeded by "Take
>| Command", which includes the free TCC/LE.
>
>| I guess it's possible to do it with CMD, but less concisely and clearly.
>
>
>4NT ? Hmmm, that's in the JP Software family of interpreters such as 4DOS which was
>OEM'd to Norton and was called NDOS ?


Indeed.

>It was great but... It is not a viable option on our Active Directory Domain.


Your loss. I couldn't do my job without it.

>The CMD.EXE, .CMD, batch processor is what I may only be able to use :-(


Maybe Microsoft's PowerShell can do it, too.

>The objective would be such as I can eventually do...
>
>net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\Firstname_Last name
>
>or
>
>net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\Firstname_MI_L astname
>
>Where aall the Domain Accounts use the naming convention; Firstname.MI.Lastname or
>Firstname.MI.Lastname


This is a bit more complicated than the original brief description; I
suppose you only want to replace the full stops after the last back
slash. This would do that:
SET Target=\\myspad.oursite.com@SSL\DavWWWRoot\Firstna me.MI.Lastname
Net Use Z: %@LEFT[%@INDEX[%Target,\,-1],%Target]%@REPLACE[.,_,%@RIGHT[-%@INDEX[%Target,\,-1],%Target]]

For details, see <http://jpsoft.com/help/functioncats.htm>.

>Personally I'd much rather use the latest version of KiXtart. I have already written, and
>tested, a KiXtart script. However our central IS group is in a time warp and is using
>KiXtart v3.60 that is (believe it or not) 11 years old! I have to write a letter of
>justification of upgrading the KiXtart interpreter on the Login Server to the latest
>version and can only "hope" they will do it. If that fails, I need a fall back position
>which would be using the .CMD batch interpreter of Vista.


Commiserations.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Zaphod Beeblebrox
Guest
Posts: n/a

 
      06-17-2010

"David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
news:...
> Using SharePoint.
> It doesn't like '.' in Usernames such as; David.H.Lipman and
> converts them to '_' so in
> SharePoint MySites the user name is; David_H_Lipman
>
> Need a .CMD script snippet that will take %USERNAME% and convert it
> to a string with '_'
> replacing all occurances of '.' within the Active Directory
> Username.
>
>
>


It's actually pretty straight forward in CMD:

SET SHAREPOINTNAME=%USERNAME:.=_%

Should work in XP and later Windows versions, possibly in Win2k but I
don't have one handy to test.

--
Zaphod

"The best Bang since the Big One" - Eccentrica Gallumbits


 
Reply With Quote
 
David H. Lipman
Guest
Posts: n/a

 
      06-17-2010
From: "Zaphod Beeblebrox" <>


| "David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
| news:...
>> Using SharePoint.
>> It doesn't like '.' in Usernames such as; David.H.Lipman and
>> converts them to '_' so in
>> SharePoint MySites the user name is; David_H_Lipman


>> Need a .CMD script snippet that will take %USERNAME% and convert it
>> to a string with '_'
>> replacing all occurances of '.' within the Active Directory
>> Username.





| It's actually pretty straight forward in CMD:

| SET SHAREPOINTNAME=%USERNAME:.=_%

| Should work in XP and later Windows versions, possibly in Win2k but I
| don't have one handy to test.

That is awesome and very eloquent - Danke !

--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp


 
Reply With Quote
 
David H. Lipman
Guest
Posts: n/a

 
      06-17-2010
From: "Zaphod Beeblebrox" <>


| "David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
| news:...
>> Using SharePoint.
>> It doesn't like '.' in Usernames such as; David.H.Lipman and
>> converts them to '_' so in
>> SharePoint MySites the user name is; David_H_Lipman


>> Need a .CMD script snippet that will take %USERNAME% and convert it
>> to a string with '_'
>> replacing all occurances of '.' within the Active Directory
>> Username.





| It's actually pretty straight forward in CMD:

| SET SHAREPOINTNAME=%USERNAME:.=_%


Man that works well..

SHAREPOINTNAME=david_h_lipman

USERNAME=david.h.lipman

net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\%SHAREPOINTNAM E%

--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp


 
Reply With Quote
 
Zaphod Beeblebrox
Guest
Posts: n/a

 
      06-18-2010

"David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
news:...
> From: "Zaphod Beeblebrox" <>
>
>
> | "David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
> | news:...
>>> Using SharePoint.
>>> It doesn't like '.' in Usernames such as; David.H.Lipman and
>>> converts them to '_' so in
>>> SharePoint MySites the user name is; David_H_Lipman

>
>>> Need a .CMD script snippet that will take %USERNAME% and convert
>>> it
>>> to a string with '_'
>>> replacing all occurances of '.' within the Active Directory
>>> Username.

>
>
>
>
> | It's actually pretty straight forward in CMD:
>
> | SET SHAREPOINTNAME=%USERNAME:.=_%
>
>
> Man that works well..
>
> SHAREPOINTNAME=david_h_lipman
>
> USERNAME=david.h.lipman
>
> net use Z: \\myspad.oursite.com@SSL\DavWWWRoot\%SHAREPOINTNAM E%
>


Glad I could help. It's not often the experts have left low-hanging
fruit like this for me to pluck when I wander through a group (but
I'll take it when it happens! (-; )

--
Zaphod

Pan-Galactic Gargle Blaster: A cocktail based on Janx Spirit.
The effect of one is like having your brain smashed out
by a slice of lemon wrapped round a large gold brick.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crysis Crashes in Win7 Vista & XP Chuck Windows Vista Games 2 03-28-2010 06:31 PM
Help, NDIS BSOD Steve Cheng Windows Vista Drivers 2 01-15-2010 09:06 AM
logon script for mapping Bonno Bloksma Scripting 1 11-27-2009 05:18 PM
Stop 0x0000007b after Setup BobMiller Windows Vista Installation 8 08-05-2006 09:29 PM
Stop 0x0000007b at end of Install BobMiller Windows Vista Installation 2 08-03-2006 06:52 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59