Jump to content

eDecisions

Members
  • Content Count

    55
  • Joined

  • Last visited

Everything posted by eDecisions

  1. Made one change this morning after testing, the log file is 50+ pages, I only really need to see the last 10 to 20lines of the log to see how things are going, added the -tail 20 to return the last 20 lines, tested this morning, I imagine next step would be to combine this for any/all longs I want and export to a text file and email as a daily summary. $dir = "C:\aktdata\quickbooks\Sync_Reports" $filter="*.txt" $latest = Get-ChildItem -Path $dir -Filter $filter | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $latest.name Get-Content $dir"\"$latest -tail 2
  2. Not my work, I took code form two locations and put them together to fit my needs, change the path to the path to your folder, change the filter to the file type to filter by, add as a script, run it, and then open your Last Executions to see the contents of the file. I was needing to check status of a log file on a server every so often, the log file name would change daily and be time stamped, this solved it for me. $dir = "C:\data\Sync_Reports" $filter="*.txt" $latest = Get-ChildItem -Path $dir -Filter $filter | Sort-Object LastAccessTime -Descending | Select-Object -First 1
  3. sure I could do that as well and have a few customers doing that, I'm looking for a zero server touch however, and the ability to bring a new printer into a company and not have to touch the server, I have an onboarding task that does all my pc setup, so I want to add printers this way, little more up front work but once done I can get a call from any office, hay ken we just purchsed an HP xyx printer can you come set it up on my computer. CLICK done I've added 3 printers already I can do this with at any office, I've even managed to scan the network for the likely IP address of t
  4. I did this for NINJA, try playing with the search key where the -match "your program" but be carefull $UninstallString = (Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NinjaRMMAgent*).UninstallString sleep -seconds 2 if (!$UninstallString) { exit } sleep -seconds 2 $path = $UninstallString -replace "uninstall.exe", "" sleep -seconds 5 cd $path sleep -seconds 5 Start-Process -FilePath .\uninstall.exe -ArgumentList "--mode","unattended" sleep -seconds 40 $Uninstall2 = Get-ChildItem -Path HKLM:
  5. I want to start a project, ADD-Printer via power shell, anyone want to help? Or you doing it alrady?
  6. I used a few times now and its about 90%, about 10% of the time my script fails to find the program, if anyone has any thoughts on what I missed please share.
  7. Darn, missed the fact that I was in session 0, ooops my bad, this should add to all active users. $Officepath = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\Path") $Profiles = Get-ChildItem 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { $_.GetValue('ProfileImagePath') } foreach ($profile in $profiles -match "Users" -notmatch "spfarm" -notmatch "spsearch" -notmatch "TEMP" -notmatch "Classic"){ $WshShell = New-Object -comObject WScript.Shell $Shortcut = $
  8. Great for onboarding new station, you can grab any other short cuts such as to shared rive, or network folders, the users C drive or the my documents folder as well, I just did the office apps. #By eDcisions $Officepath = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\Path") $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Excel.lnk") $Shortcut.TargetPath = "$Officepath\Excel.exe" $Shortcut.Save() $WshShell = New-Object -comOb
  9. What I started doing was creating Script Groups, hence every customer has their own set of scripts, however the point of this one was a little different, imagine you just want to map a drive for today between 2 computers at the office for the client, this works. If you'd like to get rid of the copy file first, conciser building the file first in powershell with the commands, and then call that file, and delete it after run. I did that with the "SHOW MAPPED DRIVES OF LOGGED IN USER" that I just posted, take a peek of how I wrote a local batch file and then ran it and deleted it. Script Gro
  10. I think thats the case, I submitted a request for info on the new feature and was told they were still working on it. So maybe this is just a pre-release, in its current form its not very usefull to me.
  11. Ok this guy will display the users mapped drive of the user thats logged into the pc as well as the status of the drive, disconnected, Ok, ect... Nice if you's setting up another pc remotely and you want to see what the shared drives on another users pc were so you can match them. #by eDecisions $Taskname = "netuse" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $Taskname /RU $lastlogon /TR "c:\maplist.bat" start-sleep -s 1
  12. its not expected to run as a stand alone script, I set this so I could run from the powershell instance, so you'd save the script above into a working folder on the client, could could call it anything you like with a ps1 Then from the power shell window you can type c:\mypath\myname.ps1 x: \\server\share were taking the %1 and %2 as $args0 and $args1, so you're completing the 2 items when you manually type the command in the powershell windows. hope that makes sense.
  13. way too much work, this adds a script by currently logged in use or last logged in user if system is logged off, note this is a powershell script, also I set its start time for before current time so it will only run if you manually start it but do what you will. #By eDecisions $TasknameStop = "ExplorerStop" $TasknameStart = "ExplorerStart" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStop /RU $lastlogon /TR "taskkil
  14. create a task, far easier, I use powershell, just add the command after the TR = Task Run #By eDecisions $TasknameStop = "ExplorerStop" $TasknameStart = "ExplorerStart" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStop /RU $lastlogon /TR "taskkill /f /im explorer.exe" SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStart /RU $lastlogon /TR "explorer.exe" start-sleep -s 1 schtasks /Run /TN $TasknameStop star
  15. if you like to run a command as the user a quick way is to create and run a scheduled task setup as the logged in user and run it, see power shell example to start and restart explorer. #By eDecisions $TasknameStop = "ExplorerStop" $TasknameStart = "ExplorerStart" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStop /RU $lastlogon /TR "taskkill /f /im explorer.exe" SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStart
  16. your missing the point of pulseway, why would you want to ever run a batch file located on your desktop, copy the batch file to pulseway and run it from there.
  17. I too played with them, I found as currently configured they are of no use to me, what I'm waiting for is a prompt at run time, you click your script and you get a prompt: enter drive lettr: or enter user name: or enter something, I'd find that a lot more usefull.Insert other media
  18. Script enables RDP if its disabled, and enables if its disabled. #By eDecisions $RDP = (Get-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server').fDenyTSConnections If ($RDP -eq 0) { Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value "1" } IF ($RDP -eq 1) { Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value "0" }
  19. This will stop and restart EXPLORER.EXE for the currently logged in user. #By eDecisions $TasknameStop = "ExplorerStop" $TasknameStart = "ExplorerStart" $lastlogon = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser") SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStop /RU $lastlogon /TR "taskkill /f /im explorer.exe" SCHTASKS /CREATE /sc ONCE /st 00:00 /TN $TasknameStart /RU $lastlogon /TR "explorer.exe" start-sleep -s 1 schtasks /Run /TN $TasknameStop start-sleep -s
  20. Be nice if you reference the Author rather than "I found this" I wrote it, thanks for the plug.
  21. This script changes the state of Hidden files, if hidden files are set to show this turns them off, if hidden files are set to hide this shows them. Comments? # This key contains all of the profiles on the machine (including non-user profiles) $profileList = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" # This key contains the path to the folder that contains all the profiles (typically c:\users) $profileFolder = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList').ProfilesDirectory
  22. Install Chocolatey choco install microsoft-teams.install -fvy
  23. Personally I'd change it to a dos batch file rather than powershell, user accont settings are easlry set there.
  24. Hay BartB, I agree, I followed your advise and it works well, I'm worried however about the source files, It would be very cool if a group of us Pulseway users worked to as a team to setup our own file hosting of secure files, interested in starting something up?
×
×
  • Create New...