Jim

Jim

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 45 total)
  • Author
    Posts
  • Jim
    Participant
    Post count: 45

    Have you tried using the Send-Keys function?

    Send-Keys -WindowTitle 'foobar - Notepad' -Key 'Hello world'

    You may need to use Get-WindowTitle to find the Window title first…

  • Jim
    Participant
    Post count: 45

    If (Get-InstalledApplication -Name NewApplication) {
    Set-RegistryKey -Key RegPathHere -Name 'RegNameHere' -Value RegValueHere
    }

  • Jim
    Participant
    Post count: 45

    How about something like this?

    $Notepad = Get-Process -Name notepad -ErrorAction SilentlyContinue
    If ($Notepad) {
    Show-InstallationProgress -StatusMessage 'Installing software'
    }

  • Jim
    Participant
    Post count: 45

    It doesn’t seem like this is possible. I tried changing the function parameter $Section so it wasn’t mandatory, and when I did that, it created an empty section- []. Does it matter where in the file the entry is? Could you just use add-content to add it to the end of the file?

    Add-Content -Value “nrtest” -Path “C:\windows\win.ini”

  • Jim
    Participant
    Post count: 45

    My guess would be that you are running the SCCM package as Admin (i.e. system) and similar to the Set-PinnedApplication function, the pintotaskbar.vbs needs to be run as the user. “This should typically be run in the user context, as pinned items are stored in the user profile.”

  • Jim
    Participant
    Post count: 45

    I’ve used the functions available on this site, http://blog.danskingdom.com/powershell-functions-to-get-an-xml-node-and-get-and-set-an-xml-elements-value-even-when-the-element-does-not-already-exist/, to read/modify XML files. Maybe they will help you…

    I’ve actually added those functions to the AppDeployToolkitExtensions.ps1 file so I can use them anytime I need them…

  • Jim
    Participant
    Post count: 45
    in reply to: Dynamic Uninstall #2343

    The get-installedapplication does support partial display names. It supports name, exact and even wildcard. You could submit a feature request to have QuietUninstall added to the list of values it finds or even just add it yourself- QuietUninstallString = $regKeyApp.QuietUninstallString. I think I’m going to do that. Thanks for the idea. My way above got the default uninstall parameters, I just manually added the /quiet /norestart since I wasn’t pulling the QuietUninstall key and didn’t have all the parameters. But it did have the /uninstall. So it looks like both of our methods get the job done, just in different ways.

  • Jim
    Participant
    Post count: 45

    Are you using $dirWSSource for anything else? Why not just put c:\sccmsupport in the XML file?

    <Toolkit_LogPath>c:\sccmsupport\</Toolkit_LogPath>
    <MSI_LogPath>c:\sccmsupport</MSI_LogPath>

  • Jim
    Participant
    Post count: 45
    in reply to: Dynamic Uninstall #2329

    Matt,

    I’ve seen other people on here post similar scripts to uninstall software. Out of curiosity, why not use the get-installedapplication function to get the uninstall string? That way you let the function figure out if it’s 64-bit or not…

    Something like this:

    $VC2013 = ((Get-InstalledApplication -Name 'Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501').UninstallString -split '" ').Trim('"')
    If ($VC2013) {
    $VC2013Uninst = $VC2013[0]
    $VC2013Params = $VC2013[1]
    Execute-Process -Path $VC2013Uninst -Parameters "$VC2013Params /quiet /norestart"
    }

    Or my post here, “http://psappdeploytoolkit.com/forums/topic/execute-process-odd-behavior/#post-2248”.

  • Jim
    Participant
    Post count: 45

    What about something like this?

    $p = (get-process -Name notepad).Id
    $WTitle = (Get-WindowTitle -GetAllWindowTitles | Where-Object {$_.ParentProcessId -eq $p}).WindowTitle
    Send-Keys -WindowTitle $WTitle -Keys '{ENTER}'

  • Jim
    Participant
    Post count: 45

    Hmmm… Interesting… It does work! But it’s still loading/unloading the ntuser.dat for each user unnecessarily. I think I like my way better for copying/deleting files/folders… But I learned something… Thanks.

  • Jim
    Participant
    Post count: 45

    Have you actually tried using that function with anything other than registry values? I looked at that function in the AppDeployToolkitMain.ps1 file and it only references registry info- reg.exe, ntuser.dat files, HKEY_Users etc. I tried using that function to copy a file today and I couldn’t get it to work… To copy or remove files or folders, you’d probably need to do something like this:

    [string[]]$ProfilePaths = Get-UserProfiles | Select-Object -ExpandProperty 'ProfilePath'
    foreach ($ProfilePath in $ProfilePaths) {
    Copy-File -Path "$dirFiles\discovery925_ug_en.pdf" -Destination "$ProfilePath\Desktop"
    }

  • Jim
    Participant
    Post count: 45
  • Jim
    Participant
    Post count: 45
    in reply to: Can't copy folders #2290

    Here’s what I did. The folder name is ‘Home Care Access’ and gets copied to the Public Desktop:

    Copy-File -Path "$dirFiles\Desktop Folders\Home Care Access" -Destination $envCommonDesktop -Recurse

  • Jim
    Participant
    Post count: 45

    Did you change the name of the process to setup or whatever window you are sending keys to?

Viewing 15 posts - 1 through 15 (of 45 total)