Jump to content
Sign in to follow this  
cpremo

PC Manipulation

Recommended Posts

cpremo

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

Share this post


Link to post
Share on other sites
Fossil Rock

@MyDocumentsDir


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites
weaponx

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?

Share this post


Link to post
Share on other sites
cpremo

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)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.