#173982 - 2007-02-16 05:27 PM
set command
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
I am writing a script in Kixtart that will give the user the option to have his my documents redirected to pass while they are logged in. The script makes the necessary changes to the registry but the changes are not reflected on the My Doc folder until the machine is restarted. I need explorer to reread the registry without a restart, I think this can be done with a "set"command.
|
|
Top
|
|
|
|
#173989 - 2007-02-16 06:35 PM
Re: set command
[Re: Shawn]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
Thanks I'll give it a try.
|
|
Top
|
|
|
|
#173992 - 2007-02-16 07:28 PM
Re: set command
[Re: cop2999]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
I get a error: unknown command [rundll32.exe] when I try this
|
|
Top
|
|
|
|
#173994 - 2007-02-16 08:20 PM
Re: set command
[Re: Les]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
I know this will work because I dug down and executed the file and it worked. Here is my line of code, I dont get an error but I also dont get any results.
Shell "RunDll32.exe user32.dll,UpdatePerUserSystemParameters ,1 ,True"
|
|
Top
|
|
|
|
#174036 - 2007-02-19 03:12 PM
Re: set command
[Re: Sealeopard]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
It is still not working, I know it should but is does not. Here is my whole script if anyone can help thanks.
$System = CreateObject("Kixtart.System") ; ;KD START ; $Form = $System.Form() ; $Form.BackColor = 212,208,200 $Form.Height = 337 $Form.Left = -16 $Form.Text = "User Setup 1.0" $Form.Top = 13 $Form.Width = 541 $GroupBox1 = $Form.Controls.GroupBox() $GroupBox1.BackColor = 212,208,200 $GroupBox1.Height = 183 $GroupBox1.Left = 60 $GroupBox1.Text = "Home Folder -- location for My Documents" $GroupBox1.Top = 45 $GroupBox1.Width = 423 $Button1 = $GroupBox1.Controls.Button() $Button1.Height = 23 $Button1.Left = 330 $Button1.Text = "Map Now" $Button1.Top = 90 $Button1.Width = 75 $Button1.OnClick = "Redirect() " $Label1 = $GroupBox1.Controls.Label() $Label1.BackColor = 212,208,200 $Label1.Enabled = "False" $Label1.Height = 24 $Label1.Left = 15 $Label1.Text = "Pass (X:) -- central Windows file service (win.pass.psu.edu)" $Label1.Top = 90 $Label1.Width = 307 $Button2 = $Form.Controls.Button() $Button2.Cancel = "True" $Button2.FontBold = "True" $Button2.FontUnderline = "True" $Button2.Height = 23 $Button2.Left = 60 $Button2.Text = "Cancel" $Button2.Top = 270 $Button2.Width = 75 $Button2.OnClick = "quit()" $Button3 = $Form.Controls.Button() $Button3.FontBold = "True" $Button3.FontUnderline = "True" $Button3.Height = 23 $Button3.Left = 240 $Button3.Text = "Help" $Button3.Top = 270 $Button3.Width = 75 $Button4 = $Form.Controls.Button() $Button4.FontBold = "True" $Button4.FontUnderline = "True" $Button4.Height = 23 $Button4.Left = 405 $Button4.Text = "OK" $Button4.Top = 270 $Button4.Width = 75 $Button4.OnClick = "UpdateUserParameters()" ; ;KD END ; $Form.Show While $Form.Visible $=Execute($Form.DoEvents()) Loop Exit 1 ;============================================== ; Function Redirect WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","y:\My Documents","REG_EXPAND_SZ") WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Personal","y:\My Documents","REG_EXPAND_SZ") EndFunction ; Function UpdateUserParameters() Shell 'RunDll32.exe user32.dll,UpdatePerUserSystemParameters' Exit @ERROR EndFunction
|
|
Top
|
|
|
|
#174037 - 2007-02-19 03:40 PM
Re: set command
[Re: cop2999]
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Hi cop2999,
You should place your code between code tags, here is a link to help you out. The Post/Reply Formatting Box And How to Use it.
Try this and let us know what you get for an error:
;
;KD START
;
$System = CreateObject("Kixtart.System")
If Not $System
$nul= MessageBox("KiXforms Not Initiated."+@CRLF+
"Please verify KiXforms is installed."+@CRLF+
"This Script Will Now Close.","Error",16)
Quit()
EndIf
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.Height = 337
$Form.Left = -16
$Form.Text = "User Setup 1.0"
$Form.Top = 13
$Form.Width = 541
$GroupBox1 = $Form.Controls.GroupBox()
$GroupBox1.BackColor = 212,208,200
$GroupBox1.Height = 183
$GroupBox1.Left = 60
$GroupBox1.Text = "Home Folder -- location for My Documents"
$GroupBox1.Top = 45
$GroupBox1.Width = 423
$Button1 = $GroupBox1.Controls.Button()
$Button1.Height = 23
$Button1.Left = 330
$Button1.Text = "Map Now"
$Button1.Top = 90
$Button1.Width = 75
$Button1.OnClick = "Redirect() "
$Label1 = $GroupBox1.Controls.Label()
$Label1.BackColor = 212,208,200
$Label1.Enabled = "False"
$Label1.Height = 24
$Label1.Left = 15
$Label1.Text = "Pass (X:) -- central Windows file service (win.pass.psu.edu)"
$Label1.Top = 90
$Label1.Width = 307
$Button2 = $Form.Controls.Button()
$Button2.Cancel = "True"
$Button2.FontBold = "True"
$Button2.FontUnderline = "True"
$Button2.Height = 23
$Button2.Left = 60
$Button2.Text = "Cancel"
$Button2.Top = 270
$Button2.Width = 75
$Button2.OnClick = "quit()"
$Button3 = $Form.Controls.Button()
$Button3.FontBold = "True"
$Button3.FontUnderline = "True"
$Button3.Height = 23
$Button3.Left = 240
$Button3.Text = "Help"
$Button3.Top = 270
$Button3.Width = 75
$Button4 = $Form.Controls.Button()
$Button4.FontBold = "True"
$Button4.FontUnderline = "True"
$Button4.Height = 23
$Button4.Left = 405
$Button4.Text = "OK"
$Button4.Top = 270
$Button4.Width = 75
$Button4.OnClick = "UpdateUserParameters()"
;
;KD END
;
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
;==============================================
;
Function Redirect()
$nul = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","y:\My Documents","REG_EXPAND_SZ")
If Not(@ERROR = 0)
? 'First WriteValue had an error# '+@ERROR
EndIf
$nul = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Personal","y:\My Documents","REG_EXPAND_SZ")
If Not(@ERROR = 0)
? 'Second WriteValue had an error# '+@ERROR
EndIf
EndFunction
;
Function UpdateUserParameters()
Shell 'RunDll32.exe user32.dll,UpdatePerUserSystemParameters'
Exit @ERROR
EndFunction
|
|
Top
|
|
|
|
#174040 - 2007-02-19 03:54 PM
Re: set command
[Re: cop2999]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
I am curently using gp to do this but for some reasons I get a real slow logon time, like 3 to 5 min. This is my work around.
Anyway the shell function is not working for me, everything else works.
|
|
Top
|
|
|
|
#174041 - 2007-02-19 04:19 PM
Re: set command
[Re: cop2999]
|
Benny69
Moderator
   
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
did you get any errors when you ran the code i modified for you?
|
|
Top
|
|
|
|
#174042 - 2007-02-19 04:42 PM
Re: set command
[Re: cop2999]
|
cop2999
Fresh Scripter
Registered: 2007-02-16
Posts: 8
|
Benny69
I did not get any errors, the reg entries are changed but the refresh does not happen.
|
|
Top
|
|
|
|
#174085 - 2007-02-20 07:53 PM
Re: set command
[Re: cop2999]
|
ChrisRogers
Lurker
Registered: 2007-02-19
Posts: 1
|
Its because windows XP im guessing your using windows XP does not Start the network up right away EG. windows 2000 Starts the network engine UP then shows the login box Where windows XP Starts the login box and allows users to login while the network engine is starting u, if you goto local computer GP, and goto System Settings >> Admin Temp >> Logon the bottom Value called Wait for network to initalise first Set that to Enable, this should put your system a tony bit slower showing the login box but your network login should fly through.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 836 anonymous users online.
|
|
|