#164598 - 2006-07-18 05:00 PM
trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
im a kix n00by...well in all honesty im a complete scripting noob! but i have managed to make an account creation script...which is very cool (IMO) but lacks 1 major thing........in my profile path within A.D. i need to have it as so \\servername\profiles%osver%\userid i use dsmod/dsmove in my script i need to push the %osver% command in as is, but it keeps resolving to \\servername\profilesXP\userid how can i get my script to keep it as %osver%?
i have tried double % to no avail.
any feedback on this would be a bonus! cheers
|
Top
|
|
|
|
#164599 - 2006-07-18 05:19 PM
Re: trying to create a profile path with %osver%
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
You must have an environment variable %OSVER% set somewhere.
If you have, you will need to escape it both in KiXtart by specifying it as %%OSVER%%, and if you are passing it to an external command you may need to escape it again!
It's a bit trial and error, but a couple of things you could try are:
- Don't use "%COMSPEC%" or "cmd" to run the commands - this will disable the command line interpreter behaviour.
- Specify the path as "^%%PATH^%%" with should disable the "%" metacharacter for both KiXtart and the external commands.
- Reset the %OSVER% environment variable so that it doesn't cause you problems.
- Avoid putting probelematical characters in your paths.
Personally I'd go for the last option.
|
Top
|
|
|
|
#164600 - 2006-07-18 06:29 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
im on it
will update!!!!!!
the 4th option is not an option (i have a requirement to meet :/ )
|
Top
|
|
|
|
#164601 - 2006-07-19 04:17 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
ok i have tried %%osver%% %%%osver%%% and ^%%osver^%% my script also disables the "set=%osver%" but still it resolves it to "profilesXP" my colleague seems to think i will need to learn about "adsi"......i think need to learn kix 1st!.
|
Top
|
|
|
|
#164603 - 2006-07-19 07:38 PM
Re: trying to create a profile path with %osver%
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Well it must be something in how you're coding it as I get the following.
Code:
'ver is: ' + %%OSVER%% ?
Returns the following for me on the console.
ver is: %OSVER%
Please post your code within CODE TAGS so we can see what you're doing.
|
Top
|
|
|
|
#164604 - 2006-07-20 06:05 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
ok
here goes nothing!!!!!
Edited by bizcuts (2006-07-21 04:19 PM)
|
Top
|
|
|
|
#164606 - 2006-07-20 07:04 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
tags......i ware one
did u not see how i started this thread "NOOBY"
thats the operative word here!
so if you could be so kind to bare with my noobish behaviour i will endevour to get it right.
tell me the definition of a "TAG"
|
Top
|
|
|
|
#164608 - 2006-07-20 07:51 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
cheers mart
im a noob but i listen and absorbe and learn!!
sooooooooooooooooo, back to the issue in hand.
can you guys spot what im doing wrong?
i am baffled as is my mentor
|
Top
|
|
|
|
#164609 - 2006-07-20 08:55 PM
Re: trying to create a profile path with %osver%
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Okay Mart was too quick for me on that one, but I'll post anyways.
However another issue is the LONG LINES You need to edit and break the long lines - the whole point is that if your post is TOO difficult to read then most people just won't take the time as we all have plenty of things to do in our daily work lives already.
So now that you know how to EDIT and use CODE TAGS, please go back and edit again and this time break the long lines so that a normal 1024x768 monitor won't need to scroll to read your post.
Thanks.
|
Top
|
|
|
|
#164610 - 2006-07-20 11:34 PM
Re: trying to create a profile path with %osver%
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
what is this: Code:
$rc="%comspec% /e:1024 /c set OSVER=" Shell $rc
wouldn't it be easier to just do: Code:
set "OSVER="
|
Top
|
|
|
|
#164612 - 2006-07-21 04:26 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
"Ok, I'm confused.
Why are you creating roaming profile directories? This is done automatically by Windows when you log off."
this i dont care about.
all i need to suss is the %osver% bit, n the jobs a good un!
if i need to rem out the roaming profiles xp\roaming profiles later...thats fine.
dont loose focus on the issue in hand!
|
Top
|
|
|
|
#164614 - 2006-07-21 04:56 PM
Re: trying to create a profile path with %osver%
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
"Ok, I'm confused.
Why are you creating roaming profile directories? This is done automatically by Windows when you log off."
this i dont care about.
all i need to suss is the %osver% bit, n the jobs a good un!
if i need to rem out the roaming profiles xp\roaming profiles later...thats fine.
dont loose focus on the issue in hand!
Uhm... this is the issue in hand.
You have a problem because you are trying to create a directory with a path name containing metacharacters. You are going to struggle to get it working because DOS is interpreting them. It's not impossible to get working, just a bit tricky.
Bearing in mind that there is rarely a good reason to create these directories in the first place, it is far simpler just to not create them and let Windows handle it instead.
If you really insist on creating them manually, you could try doing something like this: Code:
$sPath="\\server\d$\path%%OSVER%%\"+$sUserID $iResult='"'+%COMSPEC%+'" /C SET %%OSVER%%= && SomeCommand "+$sPATH+" SomeOptions"
This bit of trickery clears the OSVER variable and runs the command in the same instance of the interpreter.
|
Top
|
|
|
|
#164615 - 2006-07-21 05:02 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
Not true.
I realised that i was exposing data I shouldn’t
I will re post it once i have edited it
I am here to learn
As I said, I am new to all this. I only have one request, yet people are going off on a tangent......
If other things in my script seem odd, That’s fine. We could discuss this later after I have resolved the "current issue"
|
Top
|
|
|
|
#164616 - 2006-07-21 05:07 PM
Re: trying to create a profile path with %osver%
|
bizcuts
Fresh Scripter
Registered: 2006-07-04
Posts: 10
|
Richard H.
i will try that. and thanx
i dont have time today to mess with my script but i will update monday.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|