Jump to content

tazdev

Active Members
  • Posts

    89
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

tazdev's Achievements

Wayfarer

Wayfarer (2/7)

1

Reputation

  1. Recently I have had to deal with a lot of customers who want to send documents to a share on their own PC. Keep in mind I always recommend using a server for SMB shares however, some people don't have a server or enough people to warrant having a server. I made the following so that my technician can have this on a flash drive and it will create a share exactly the same way each time so I know what was done in case there is an issue. It will create the share (If it exists then it does not change the share called scan) It will create the user (if the user exists it will not modify that user) It will create a password for that user (If the user exists it will not change anything) It will create a shortcut to the share on the desktop It will grant the user full rights to the share both in permissions and security I hope you find it useful. It can probably be made cleaner but it does work for me so I don't mess with it too much. It will also create a TXT doc on the screen for the tech to use and a TXT file on the flash drive as a backup so they will know what was done. BTW, I just realized that I have a myshortcut.vbs file that gets installed. The VBS is noted in the notes in the script so you can make it if you want or incorporate it. #cs Creates a folder on the root of C: called scans Creates a local user scan on the PC Attempts to create a share called scans based on the folder above, if it already exists then it does nothing Adds full control to everyone adds scan user full permissions to the share Pops up a notepad with the information for the customer to save and the tech to read off or print out Since I do not know what the actual folder name is of the share I cannot create a shortcut Created on a workstations create a shortcut using the unc \\@computername\scans VBS Stuff in case I am on a PC that does not have the script: --------------------------------- set WshShell = WScript.CreateObject("WScript.Shell" ) set oShellLink = WshShell.CreateShortcut(Wscript.Arguments.Named("shortcut") & ".lnk") oShellLink.TargetPath = Wscript.Arguments.Named("target") oShellLink.WindowStyle = 1 oShellLink.Save --------------------------------- #ce #include <array.au3> #include <string.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <File.au3> ; Declare vars ----------------------------------------- #Region Declare Variables Global $ver = "1.051" Global $uName = "scan" Global $hName = @ComputerName Global $lPath = "C:\scans" Global $tFname = "deleteme.txt" Global $sName = "scans" Global $uPassword = "Scanningpass" Local $cntr = 1 Global $shareCmdE = "net share scans=" & $lPath & " /grant:everyone,FULL" Global $shareCmdS = "cacls " & $lPath & " /T /E /G " & $uName & ":f" Global $userCmds = "net user " & $uName & " " & $uPassword & " /ADD /FULLNAME:Scan_Acct" Local $iFileExists = FileExists ($lPath&"\"&$tFname) ; Get the customer name Global $cName = InputBox(" Customer Name", "Please enter the Customer Name:","","") Global $subject = """Scan setup for " & $cName & " <- Company""" Global $cFile = @ScriptDir & "\" & $cname & "\" & $cName & "_scans.txt" Global $txt = "Share name: \\" & @ComputerName & "\" & $sName & @CR & "User: " & $uName & @CR & "Password: " & $uPassword & @CRLF & "Please save for future reference" & @CR & "Version: " & $ver Global $txtEmail = """Share name: \\" & @ComputerName & "\" & $sName & " ""& vbCRLF & """ & "User: " & $uName & " ""& vbCRLF & """ & "Password: " & $uPassword & """ & vbCRLF & """ & "OS: " & @OSARCH & " - " & @UserName & " - " & @OSVersion & """ & vbCRLF & """ & "Version: " & $ver & " """ #EndRegion #Region Start_of_Program FileInstall( "C:\mkshortcut.vbs", @ScriptDir&"\mkshortcut.vbs", 1) NameofCompany() If $iFileExists Then makeshare() Else FileOpen($lPath&"\"&$tFname,9) makeshare() EndIf FileClose( $cFile ) FileClose($lPath&"\"&$tFname) FileDelete($lPath&"\"&$tFname) #EndRegion Func NameofCompany() ;$nowild = 1 $nowildq = StringInStr( $cName, "?") $nowildstar = StringInStr( $cName, "*") $nowildbk = StringInStr( $cName, "\") $nowildfwd = StringInStr( $cName, "/") $nowild = $nowildbk + $nowildfwd + $nowildq + $nowildstar ;MsgBox (0,"Nowild", $nowild & @CRLF & "$nowildstar: " & $nowildstar) While $nowild <> 0 $nowildq = StringInStr( $cName, "?") $nowildstar = StringInStr( $cName, "*") $nowildbk = StringInStr( $cName, "\") $nowildfwd = StringInStr( $cName, "/") $nowild = $nowildbk + $nowildfwd + $nowildq + $nowildstar ;MsgBox (0,"Nowild", $nowild & @CRLF & "$nowildstar: " & $nowildstar) Global $cName = InputBox(" Customer Name", "Name cannot contain * ? / or \" & @CRLF & "Please enter the Customer Name:","","") $nowildq = StringInStr( $cName, "?") $nowildstar = StringInStr( $cName, "*") $nowildbk = StringInStr( $cName, "\") $nowildfwd = StringInStr( $cName, "/") $nowild = $nowildbk + $nowildfwd + $nowildq + $nowildstar ;MsgBox (0,"Nowild", $nowild & @CRLF & "$nowildstar: " & $nowildstar) WEnd ;MsgBox(0,"test", $nowild & @CRLF & $cname) EndFunc Func makeshare() RunWait( @ComSpec & " /c" & $usercmds, @ScriptDir, @SW_HIDE) RunWait( @ComSpec & " /c" & $sharecmde, @ScriptDir, @SW_HIDE) RunWait( @ComSpec & " /c" & $sharecmds, @ScriptDir, @SW_HIDE) RunWait( @ComSpec & " /c" & "mkshortcut /target:""\\" & $hName & "\" & $sName & """ /shortcut:""ScannedDocs""", @ScriptDir, @SW_HIDE) FileCopy( @ScriptDir & "\ScannedDocs.lnk",@DesktopCommonDir & "\ScannedDocs.lnk") FileOpen ( $cFile, 9) FileWriteLine ($cFile, $txt) FileClose ($cfile) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send ( $txt ) FileDelete(@ScriptDir&"\ScannedDocs.lnk") FileDelete(@ScriptDir&"\mkshortcut.vbs") EndFunc
  2. Not what I am looking for but thank you. I am looking for a way at CLI level to modify the default settings on a Direct IP install printer. Thanks
  3. I have searched and searched but cannot find where these are stored. I have scripts to install printers and can even set on as a default. I have it running silent as well. What I need to be able to do is to set the printer to not print out 2 sided and when it is a color printer have it set to print black and white by default. Currently I have tried rewriting the driver with manufacture utilities but this causes the driver to no longer be signed. Also, it is acting up in the 32bit OSs. If I can just use the standard drivers from the manufacturer and set the defaults as noted above I would be set. Anyone know where these settings are in the registry/file/limbo/morodoor? If not, anyone know what is needed to make it happen in the background? With time I am sure I can bring up the dialog box, count the tabs and spaces and make it a series of steps that show but I want no user interaction. Thanks, Tim
  4. For some reason I completely forgot about cscript and was banging my head against the keyboard trying to do it myself. Thank you very much for the reminder!
  5. I have that already. What I did not have was it TURNED ON!!! LOL There is a lnk file that is in the program group for AutoItV3->beta that will switch you over to it. I love that second sample script. I know exactly what I am gonna use it for.
  6. I must be missing something. I get an error of Unknown function name for: $oShellApp = ObjCreate ("shell.application") $oShellApp = ^ Error Not sure why since the comments here show that it does work. What did I do wrong? #include <extprop.au3> $path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)") $prop = _GetExtProperty($path,21) ConsoleWrite("Property #"&$i&": "&$prop&@CRLF) I mean am I using the wrong version? Also how do you tell what version you have? I have V3 is all the folder says.
  7. AutoIT will do a quick and dirty Software inventory to a TXT file: func appsinvlocal() $y = 1 $k = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $pcl = StringLeft(@Computername, 2) $d = ( @MON & "\" & @MDAY & "\" & @YEAR & " - " & @HOUR & ":" & @MIN) $li386 = ("C:\I386") $fn = (@TempDir & "\" & @ComputerName & "-programs.txt") If FileExists( $fn ) then FileDelete( $fn ) EndIf $f = FileOpen( $fn, 1) ; Check if file opened for writing OK If $f = -1 Then Exit EndIf FileWrite($f, $d & @CRLF) Do $a = RegEnumKey($k, $y);gets the key $as = Stringleft($a, 1) $sv = RegRead($k & "\" & $a, "DisplayVersion") $sn = RegRead($k & "\" & $a , "DisplayName") If $as = "{" then $y = $y + 1 $a2 = ($sn & " - " & $sv) FileWrite($f, $y & " - App: " & $a2 & @CRLF) Else If $a = "" Then FileWrite($f, @CRLF) $y = $y + 1 Else FileWrite($f, $y & " - App: " & $a & " - " & $sv & @CRLF) $y = $y + 1 EndIf EndIf Until $a = "" FileClose($f) EndFunc I use this to create a text file in the I386 folder based on the PC's name. It will list all the apps that the registry has listed in it. With some tweaking you could make this work from your PC to a remote PC if you wanted but you would need to change a couple of vars.
  8. Tested and working used this line as the syntax. I modified it for the PC names and folder names. Worked very nicely. I looked on the target PC and checked the permissions. Domain Users has Read and Write rights and Admins have full control. Important to note that CACLS will REPLACE not add to the current security settings for the folder. echo y| CACLS "\\<PCNAME>\C$\<FOLDER>" /G "Domain Users":C Administrators:F
  9. Looks like CACLS.EXE is what I am looking for. Yes I have admin rights (as I noted already) on ALL PC's. However, I do not want to change the current security structure instituted by our director. All I want to do is make an install that will push the backup routine to each PC I select, then change the permissions on the folder it will create so that the users have read/write access to it. This is not so much a problem with 2000 as it is with XP. 2000 is not set up that way but we are doing something different with XP. Thanks jefhal
  10. I am stuck. Here is what I need to do, I have a script that will run on the user's PC. It notes the OS and the network printers installed. After so many logins it even backs up the user's favorites. However, I am using a counter in the text file created so that it only backs up every 15th time. The problem is this: there has been a change in the security structure. The XP OS has it set so that regular user's have only read access to the main folder and subfolders. They have full access to the temp folder but since I have a counter in the TXT file and they clean that folder out I don't want it there. What I would like to know is: Is there a way to have a script that I run from my PC (I am an admin on all PC's) that will let me create a folder and set up the rights on the remote PC to allow users to have read/write permissions on that folder? I know how to create the folder but the folder has inherited rights. Those have the user with no write permissions. I need them to have write permissions. Any ideas? I am out of them.
  11. Yeah but I am speaking about the name of the actual keys I need to extract from. I posted the script in Scripts and Scraps
  12. This will do a quick and dirty software inventory on the PC you run it on. It basically searches the registry's uninstall section and reports all the stuff there. Exports it to at Text file on the root of c: named after the PC's name-programs.txt (Thanks Larry) #cs Routine to get a listing of all the software uninstallable from Add/Remove Programs It works well as an inventory of sorts for the PC Exports it to a text file on the root of C:\ named after the PC you are on. Tazdev 06-28-05 tazdev@gmail.com Version 1.00 #ce $ver = "1.00" $y = 1 $k = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $fn = ("c:\" & @ComputerName & "-programs.txt") If FileExists( $fn ) then FileDelete( $fn ) EndIf $f = FileOpen( $fn, 1) ; Check if file opened for writing OK If $f = -1 Then Exit EndIf Do $a = RegEnumKey($k, $y);gets the key $as = Stringleft($a, 1) $sv = RegRead($k & "\" & $a, "DisplayVersion") $sn = RegRead($k & "\" & $a , "DisplayName") If $as = "{" then $y = $y + 1 $a2 = ($sn & " - " & $sv) FileWrite($f, $y & " - App: " & $a2 & @CRLF) Else If $a = "" Then FileWrite($f, @CRLF) $y = $y + 1 Else FileWrite($f, $y & " - App: " & $a & " - " & $sv & @CRLF) $y = $y + 1 EndIf EndIf Until $a = "" FileClose($f)
  13. Sweeeet so now I just need AutoIT to read each line until "" and look for DisplayName and possibly DisplayVersion. Export that to a TXT file and I have a software inventory routine! MUHAHAHAHAHAHAHA Man I just LOVE AutoIT.
  14. I am looking for a way to get the listing of the software installed on a PC. I have some utilities that will do it one PC at a time and AdvancedRemoteInfo keeps dying during a batch listing. Idealy I would like it to run from a commandline and be automated so that it will run like every 20th time someone logs in and exports the info to a text file. If this is stored in the registry in a common location then I can use the reg tools in AutoIT to get it and add it to a text file. I am hoping for that. If not then I hope there is a command line tool for Windows NT, 2000, and XP that will let me get that info. If that is the case then I can use AutoIT to automate the process. Anyone?
×
×
  • Create New...