Jump to content
Sign in to follow this  
pablo472

Logon.vbs script help

Recommended Posts

pablo472

Hi, I'm completely new to scripting and AutoIT was recommended to me.

I’m trying to copy a Logon.vbs script to the Logon scripts folder in Win 7 x64 and add a registry key using AutoIT.

When compiled, the adding of the Reg key works fine but the copying/installing of the reg file to the ScriptsLogon folder will not play ball.

So far, I’ve tried the following two scripts but to no avail. Any ideas?

;Automate copying of .VBS file from local folder to Logon script folder

;Then add a Registry DWORD with a value of 1 to enable Logon Scripts to be run

#RequireAdmin

FileInstall(".Logon.vbs", "C:\Windows\System32\GroupPolicyUserScriptsLogon")

RegWrite ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "EnableLinkedConnections", "REG_DWORD", "00000001")

-------------------------------------------------------

;Automate copying of .VBS file from local folder to Logon script folder

;Then add a Registry DWORD with a value of 1 to enable Logon Scripts to be run

#RequireAdmin

RegWrite ("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "EnableLinkedConnections", "REG_DWORD", "00000001")

Local $b = True

Local $dest = True

If $b = True & $dest = True Then FileInstall ("C:UsersPaulDesktopScriptingToolsNew folderLogon.vbs", $dest = @WindowsDir & "System32GroupPolicyUserScriptsLogon")

Regards

Share this post


Link to post
Share on other sites
Melba23

pablo472,

Welcome to the AutoIt forum. :)

Please do not hijack an existing thread, just start a new one - especially when there was not a lot to link your question to it. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
water

Please wait at least 24 hours before you bump a thread.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

Line

If $b = True & $dest = True Then FileInstall ("C:\Users\Paul\Desktop\ScriptingTools\New folder\Logon.vbs", $dest = @WindowsDir & "\System32\GroupPolicy\User\Scripts\Logon\")
should read:

If $b = True And $dest = True Then FileInstall ("C:\Users\Paul\Desktop\ScriptingTools\New folder\Logon.vbs", @WindowsDir & "\System32\GroupPolicy\User\Scripts\Logon\")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
pablo472

My apologies Water.

Just a newbie pulling my hair out.

Won't happen again and thank you very much. I will give it a try.

Kind Regards

Share this post


Link to post
Share on other sites
water

The "&" you used is a concatenation operator, not a logical operator.

When setting parameters you never pass the name of the parameter ($dest) but just the value.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
pablo472

Hmmm, still no luck.

Not quite sure what I'm doing wrong:

#RequireAdmin
RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "REG_DWORD", "00000001")
Local $b = True
Local $dest = True
If $b = True And $dest = True Then FileInstall ("C:\Users\Paul\Desktop\Scripting\Newfolder\Logon.vbs", @WindowsDir & "\System32\GroupPolicy\User\Scripts\Logon\")

Even renamed and removed the space between New Folder\

Edited by pablo472

Share this post


Link to post
Share on other sites
water

Can you manually copy the file to @WindowsDir & "System32GroupPolicyUserScriptsLogon"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
pablo472

Oddly enough yes and although we have been doing this manually, I was determined to automate it.

Will have another go tomorrow.

Share this post


Link to post
Share on other sites
pablo472

Ok, I finally got it to work with this:

#RequireAdmin
RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLinkedConnections", "REG_DWORD", "00000001")

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
Local $b = True
Local $dest = True
If $b = True And $dest = True Then FileInstall ('C:\Users\Paul\Desktop\Scripting\Newfolder\Logon.vbs', @WindowsDir & '\System32\GroupPolicy\User\Scripts\Logon\')
DllCall("kernel32.dll", "int", "Wow64EnableWow64FsRedirection", "int", 1)

Only trouble is, it doesn't actually select/enable the script as it would if you did it manually within GPedit, therefore although the script itself does as it's asked, it doesn't finish the job so to speak.

Any ideas if it's possible to get it to select/enable the script as you would manually?

Regards

Share this post


Link to post
Share on other sites
pablo472

Any ideas?

Share this post


Link to post
Share on other sites
pablo472

12 months on and still no luck! LOL
I gave up and did it all manually in the end using a .reg and .vbs scripts. Would have been nice to automate the whole thing though.
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×