Jump to content

PC Manipulation


 Share

Recommended Posts

I'm really new to AutoIT and need some help. Our HelpDesk manager want to push a change to all PCs without having to manually touch them. If possible we would like to do this:

1. Determine the logged in users "C:\Documents and Settings" user folder string (i.e., C:Documents and Settings\UserName\My Documents).

2. After creating a new folder at root (C:\PCUpdates), give all users full rights to the folder.

We would then use this folder to "Push" any changes we want to make to the PC using AutoIT.

So basically, I'm asking a favor for assistance in writing the code to accomplish this task.

Thanks.

Edited by cpremo
Link to comment
Share on other sites

You need to elaborate on your usage of the term "push".

Are you intending to launch a program remotely?

- or -

Are you wanting to copy a file into C:\PCupdates which the user will be able to run?

Link to comment
Share on other sites

First, I'm trying to create a new folder called "C:\PCUpdates". I found this code and it seems to cover most of the issue, but is externally stored. If possible, I'd like to re-code it to run within the AutoIT executable.

' Beginning of Sample VBScript to create a folder and
' assign user permissions

Option Explicit
Dim objFSO, objFolder, objShell, strDirectory
Dim strHome, intRunError

strDirectory = "c:\PCUpdates"

' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
   Set objFolder = objFSO.GetFolder(strDirectory)
   'WScript.Echo strDirectory & " already created "
Else
   Set objFolder = objFSO.CreateFolder(strDirectory)
   'WScript.Echo "Just created " & strDirectory
End If

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
' Assign user permission to home folder.
intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " & strDirectory & " /t /c /g Everyone:F ", 2, True)
End If

WScript.Quit

' End of Sample VBScript to create a folder with error-correcting Code

This is my current AutoIT executable.

If Not IsAdmin() Then
    RunAsSet('administrator', @Computername, 'Password')
EndIf

RunWait(@ComSpec & ' /c "C:\TEMP\Zen10\NewFolder.vbs"', @SystemDir, @SW_HIDE)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...