Re: Need Help Setting Variable

From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 02/06/05


Date: Sat, 5 Feb 2005 17:43:03 -0700


"Donovan Linton" <DonovanLinton@discussions.microsoft.com> wrote in message
news:2B02B49A-F712-4428-87D5-34244C705FFA@microsoft.com...
> All the systems are WinXP (I just noticed it said Win2000),and migrating
to
> new computers, I didn't user the %username% value because I will be logged
in
> as myself running the migration.
>
> Thanks for your response.
>
> I was put in charge up migrating my departments data, so any more
suggestion
> to make this process easier is greatly apprecitated.

One suggestion I would seriously consider is to adopt a policy that storage
of departmental data NOT be allowed on workstations, but only on servers.

/Al

> Donovan
>
> "Al Dunbar [MS-MVP]" wrote:
>
> >
> > "Donovan Linton" <Donovan Linton@discussions.microsoft.com> wrote in
message
> > news:0D094478-963B-4800-B093-C80324F3A331@microsoft.com...
> > > Hi Im pretty new to scripting but I need help getting/setting a
variable
> > > (don't know if Im saying that right)
> > >
> > >
> > > Basically what I want to do is have the script ask for the username
and
> > then
> > > be able to assign it as a variable(Again, excuse me if I'm not using
the
> > > correct words).
> >
> > First question: by "the username" do you mean the username of the
currently
> > logged in user, or is this a script you will be running from an
> > administrative account to do some processing against a whole bunch of
other
> > normal user accounts.
> >
> > Second question: what operating system is running on the computer from
which
> > this batch will be run?
> >
> > Way at the bottom are a few suggestions...
> >
> > > Heres what I have now.
> > >
> > > net use B: \\itchy\share
> > > net use Z: \\itchy\usmt
> > >
> > > md b:\%computername%_%1
> > >
> > > z:\scanstate b:\%computername%_%1 /user:%1 /i:migsys.inf
/i:miguser.inf
> > > /i:sysfiles.inf /c /o /v:1 /l:b:\Logs\%computername%_%1.txt
> > >
> > > net use B: /delete
> > > net use Z: /delete
> > >
> > > shutdown -l
> > >
> > >
> > > This works great but instead of having to open command and run
> > > bat.cmd dlinton
> > >
> > > I want the script to ask me the username and then substitute that with
the
> > > %1 or what ever variable names.
> > >
> > > Thanks Any help appreicaited
> > > Donovan
> > >
> > > Also I will gladly take suggestions on the rest of the script.
> >
> > If this is running on an NT series system, and if the username is that
of
> > the currently logged in user, then simply replace %1 with %username% in
your
> > script. That environment variable is defined by the o/s to contain the
name
> > of the currently logged in user, in much the same way that
%computername%
> > gives the name of the computer.
> >
> > If you actually need it to prompt for the username of another account,
and
> > if you are running this from XP, w2k, or w2k3, then try this:
> >
> > (set/p user=Enter the username to be processed: )
> > > net use B: \\itchy\share
> > > net use Z: \\itchy\usmt
> > >
> > REM - replace - md b:\%computername%_%1
> > md b:\%computername%_%user%
> > >
> > REM - replace - z:\scanstate b:\%computername%_%1 /user:%1 /i:migsys.inf
> > /i:miguser.inf /i:sysfiles.inf /c /o /v:1
/l:b:\Logs\%computername%_%1.txt
> > z:\scanstate b:\%computername%_%user% /user:%user% /i:migsys.inf
> > /i:miguser.inf /i:sysfiles.inf /c /o /v:1
> > /l:b:\Logs\%computername%_%user%.txt
> > >
> > > net use B: /delete
> > > net use Z: /delete
> > >
> > > shutdown -l
> >
> > If you are running on NT or 9x, there are some workarounds available to
> > simulate the input functionality.
> >
> >
> > Scanstate seems to be used for migrating user profile information
through an
> > o/s upgrade from 9x to 2k. Since you are explicitly doing a shutdown, it
is
> > not clear to me what your answers are to my first question at the top.
> > Assuming this will be run by the user account being processed, and
assuming
> > windows98, there is another way to determine the name of the current
user.
> > There is at least one command whose output includes the name of the
current
> > user on w98 systems (I think it is ipconfig/all, but lacking any w98
systems
> > at home, I am not sure). You could redirect this output to a file, and
then
> > parse that file to extract the name.
> >
> >
> > /Al
> >
> >
> >



Relevant Pages

  • Re: Need Help Setting Variable
    ... I didn't user the %username% value because I will be logged in ... I was put in charge up migrating my departments data, ... >> Basically what I want to do is have the script ask for the username and ... > normal user accounts. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: NETDOM ; move workstation from NT4.0 Domain to W2K3 Domain
    ... Yes there are like 12 separate wizards for migrating different items the most common of which: ... User accounts ... Computers ...
    (microsoft.public.windows.server.migration)
  • Re: Simplest fully open LAN configuration for XP Pro SP2
    ... If the AltDefaultUserName is being reset to "Administrator", ... Ssince all these computers were NOT ... > 2- renamed this one account the same name on all computers ... > DefaultUserName value was still set to the ORIGINAL username for this ...
    (microsoft.public.windowsxp.network_web)
  • Re: network help with XP
    ... if you don't want a password and also disable guest account, ... create the same username on all computers and logon automatically. ... Posting on MS newsgroup will benefit all readers and you may get more help. ...
    (microsoft.public.windowsxp.network_web)
  • Re: protected share on XP and 2k3
    ... both computers are on the same workgroup, both have the same IP scheme ... > networking protocol, a common workgroup, and common user names and ... i get prompted for a username and password. ...
    (microsoft.public.windows.server.networking)