Discussion:
Need .CMD script module
(too old to reply)
David H. Lipman
2010-06-16 21:00:19 UTC
Permalink
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
Michael Bednarek
2010-06-17 01:01:00 UTC
Permalink
On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
Post by David H. Lipman
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"
David H. Lipman
2010-06-17 01:23:36 UTC
Permalink
From: "Michael Bednarek" <ROT13-***@gtz.pbz.nh>

| On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
Post by David H. Lipman
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: \\***@SSL\DavWWWRoot\Firstname_Lastname

or

net use Z: \\***@SSL\DavWWWRoot\Firstname_MI_Lastname

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
Michael Bednarek
2010-06-17 09:13:28 UTC
Permalink
Post by David H. Lipman
From: "Michael Bednarek"
| On Wed, 16 Jun 2010 17:00:19 -0400, "David H. Lipman" wrote in
Post by David H. Lipman
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.
| 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.
Post by David H. Lipman
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.
Post by David H. Lipman
The CMD.EXE, .CMD, batch processor is what I may only be able to use :-(
Maybe Microsoft's PowerShell can do it, too.
Post by David H. Lipman
The objective would be such as I can eventually do...
or
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=\\***@SSL\DavWWWRoot\Firstname.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>.
Post by David H. Lipman
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"
Zaphod Beeblebrox
2010-06-17 12:13:31 UTC
Permalink
Post by David H. Lipman
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
David H. Lipman
2010-06-17 20:36:31 UTC
Permalink
Post by David H. Lipman
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
David H. Lipman
2010-06-17 20:42:22 UTC
Permalink
Post by David H. Lipman
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: \\***@SSL\DavWWWRoot\%SHAREPOINTNAME%
--
Dave
http://www.claymania.com/removal-trojan-adware.html
Multi-AV - http://www.pctipp.ch/downloads/dl/35905.asp
Zaphod Beeblebrox
2010-06-18 12:02:14 UTC
Permalink
Post by David H. Lipman
Post by David H. Lipman
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.
| SET SHAREPOINTNAME=%USERNAME:.=_%
Man that works well..
SHAREPOINTNAME=david_h_lipman
USERNAME=david.h.lipman
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.
Loading...