Jump to content

Search the Community

Showing results for tags 'powershell'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 34 results

  1. Embed powershell

    Not sure if this is possible or if someone has already tackled this. Is it possible to embed PowerShell into a GUI? Autoit is great for quick function but sometime I need to run a command thru PowerShell. It be great to have PowerShell console embedded into the gui.
  2. After much searching I finally found a method to get eMails from an Exchange eMail account inbox. I was hoping for AutoIT or vbscript but I couldn't find any that would read the inbox messages without using Outlook. I needed this because I'm testing a web-form that generates an eMail sent to a shared mailbox "not what my current outlook is configured for". so, I needed to connect to a different account, then get the inbox messages, and see if the auto-generated eMail message body contains what I submitted in the form. I found a PowerShell script that was close and modified it to do just what I want, but I'd still like it to run in AutoIT but I'm not sure how to use the Microsoft.Exchange.WebServices.dll Anybody have some ideas? #To Launch! # C:\Windows\System32> powershell -ExecutionPolicy ByPass #This launches PowerShell and allows execution of .ps1 files # PS C:\Windows\System32> . "C:\Temp\eMail\getInbox.ps1" #The period . in front of the .ps1 file forces PS to display results on-screen # Where is the EWS .DLL file that you are using # Get the installer from https://www.microsoft.com/en-us/download/details.aspx?id=42022 # We only need 2 dll's from the install and they can be stored anywhere: "Microsoft.Exchange.WebServices.Auth.dll" & "Microsoft.Exchange.WebServices.dll" $EWSdll = "C:\Temp\eMail\Microsoft.Exchange.WebServices.dll" # Where do you want the output text file to be saved $Output = "C:\Temp\eMails.txt" # replace with your email address $email = "MyemailAddress@work.net" # only need to populate these if you're impersonating... $username = "myemail" $password = "Sup3rS3cre+" $domain = "ad.work.net" # load the assembly : point to the dll in the location you have the .dll file [void] [Reflection.Assembly]::LoadFile($EWSdll) # set ref to exchange, first references 2007, 2nd is 2010 (default) #$s = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1) $s = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService # use first option if you want to impersonate, otherwise, grab your own credentials with the 3rd one. not sure what the 2nd one is for $s.Credentials = New-Object Net.NetworkCredential($username, $password, $domain) ##$s.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials #$s.UseDefaultCredentials = $true # discover the url from your email address $s.AutodiscoverUrl($email) # get a handle to the inbox $inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox) #create a property set (to let us access the body & other details not available from the FindItems call) $psPropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties) $psPropertySet.RequestedBodyType = [Microsoft.Exchange.WebServices.Data.BodyType]::Text; # If you have a set number of items you want to get, use this and insert the # in the () # $items = $inbox.FindItems(5) # If you want to retrieve all items (Server limit is usually at 1000) then use this line # Details on the max returned by server: https://blogs.msdn.microsoft.com/exchangedev/2010/03/12/throttling-policies-and-the-ewsfindcountlimit/ $items = $inbox.FindItems($inbox.TotalCount) # Put some counts at the top of the output Write-host "Total Inbox count: $($inbox.TotalCount)" Write-host "Unread count: $($inbox.UnreadCount)" #These two lines, write the output to the specified text file Add-Content $Output "Total Inbox count: $($inbox.TotalCount)" Add-Content $Output "Unread count: $($inbox.UnreadCount)" foreach ($item in $items.Items) { # load the property set to allow us to get to the body $item.load($psPropertySet) # Get the Body text as-is $bod = $item.Body.Text #if you only want a short summary of the Body, then comment the above line and un-comment these 4 lines # $bod = $item.Body.Text -replace '\s+', ' ' # $bodCutOff = (100,$bod.Length | Measure-Object -Minimum).Minimum # $bod = $bod.Substring(0,$bodCutOff) # $bod = "$bod..." # output the results - first of all the From, Subject, References and Message ID write-host "====================================================================" Write-host "From: $($item.From.Name)" Write-host "Subject: $($item.Subject)" Write-host "Body: $($bod)" write-host "====================================================================" "" # Output the results to the specified Text file Add-Content $Output "" Add-Content $Output "====================================================================" Add-Content $Output "From: $($item.From.Name)" Add-Content $Output "Subject: $($item.Subject)" Add-Content $Output "Body:",$($bod) Add-Content $Output "====================================================================" Add-Content $Output "" } #see these URLs for more info # EWS Stuff # folder members: https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.folder_members%28v=exchg.80%29.aspx # exporting headers: https://www.allabout365.com/2010/10/export-email-headers-exchange-powershell/ # read emails with EWS: https://social.technet.microsoft.com/Forums/en-US/3fbf8348-2945-43aa-a0bc-f3b1d34da27c/read-emails-with-ews?forum=exchangesvrdevelopment Thanks, Mike
  3. Hi all, I need to read a log file into an array, but the log file is encoded as $FO_UTF16_BE_NOBOM (2048) = Use Unicode UTF16 Big Endian (without BOM) per FileGetEncoding (it returns 2048). I have searched how to convert these log files to UTF-8 and finally found a Powershell command. Since then I have been racking my brain trying to get the function to work. The command itself works from a Powerscript prompt: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Get-Content C:\Logs\Myplayer_10-10-17-02-31.log | Set-Content -Encoding utf8 C:\Logs\Myplayer1.log This is my sandbox; #include <array.au3> #include <File.au3> Local $aArrayLogFile Local $sLogDir = "C:\Logs\" Local $sLogFile = "Myplayer_10-10-17-02-31.log" Local $sConvertedLog = "ConvertedLog.log" Local $sLogDirFile = $sLogDir&$sLogFile RunWait("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Get-Content "&$sLogDirFile&" | Set-Content -Encoding utf8 "&$sConvertedLog,$sLogDir) _FileReadToArray($sLogDirFile, $aArrayLogFile) _ArrayDisplay($aArrayLogFile) Also tried RunWait("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Get-Content "&$sLogDirFile&" | Set-Content -Encoding utf8 "&$sConvertedLog,$sLogDir) and ShellExecuteWait("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"," -Command Get-Content "&$sLogDirFile&" | Set-Content -Encoding utf8 "&$sConvertedLog,$sLogDir) Tried without -Command and a bunch of other parameters that were sprinkled throughout the internet from people trying to get this to work. Thanks Jibs
  4. I am maintaining all the reusable code in a separate file as library.au3. In that file I have referenced some dependent files using fileinstall, so that they will be extracted when necessary. Problem is, if I use a function in the library.au3 in another script which doesn't require this dependent file, as I am including the whole file using include tag, it is embedding that file also. Is there any way to exclude that.
  5. Hi guys, I need a little help here I have this simple Powershell script, that is able to set "sig.htm" as signature in OWA for the mail account specified. First part of the script just loads the Exchange snapin, since this is needed for the Get-Mailbox command. #Add Exchange 2010/2013 snapin if not already loaded in the PowerShell session if (!(Get-PSSnapin | where {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"})) { try { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction STOP } catch { #Snapin was not loaded Write-Warning $_.Exception.Message EXIT } . $env:ExchangeInstallPath\bin\RemoteExchange.ps1 Connect-ExchangeServer -auto -AllowClobber } $mailboxes = Get-Mailbox -Identity user@domain.com $mailboxes| foreach {$file= "sig.htm"; Set-MailboxMessageConfiguration -identity $_.alias -SignatureHtml "$(Get-Content -Path $file -ReadCount 0)"} What I want is for AutoIt to use Powershell.exe to run the script somehow. This way I would be able to use AutoIt variables and arrays together with the PS script. I guess the solution would be to run Powershell.exe with command line arguments? If that is not possible, maybe have the script stored as a "ps1" file, and interact with it that way? (not preferred)
  6. Hello, Currently I am running a script that calls a powershell script. To read the results of that I am reading StdOut. I am parsing things accordingly but unfortunately it doesn't parse correctly all the time and I end up missing parts of the string or other problems. My question then is, what is the best results for reading what is returned when running a powershell script or something similar?
  7. Hi guys, This is probably an obvious one, but I really don't use this command at all so am hoping you can spot my mistake. I'm running a powershell script on a schedule with the following script in a function, the function is being called in a loop, but the console process is not closing in the background and I end up with a bunch of console windows running in the background: Run(@comspec & ' /k PowerShell.exe -STA -NonInteractive -ExecutionPolicy ByPass -Command "& ''Z:\Powershell\365\GetNextDetails.ps1'' "', "", @SW_HIDE) Thanks!
  8. !Arf it i used [Start new topic] when i was in GUI section and the post was moved without i even noticed it. Can an admin move that to general (SORRY)! Hello guys ME again and my ugly english xD. This is the only one powershell command i am not able to use becose i dont found a way to insert the USERNAME $Variable at the first line. i am not able to find a third way to QUOTE a variable when i use "*" for the AutoIt command and the '*' for the PS command but i need to QUOTE inside the '*'PS command my $Variable $iPid = run("powershell get-aduser -Filter {sn -eq 'USERNAME'} -Properties sAMAccountName,Title" , @WindowsDir , @SW_HIDE , 0x2) $AllInfo = "" While 1 $AllInfo &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $AllInfo = stringsplit($AllInfo , @LF , 2) ;split result in all @LF but don't use the splitted result for anything _ArrayDisplay($AllInfo) This gonna be my last question becose i can do all the rest (i guess & wish ) alone
  9. Hello. I improved my powershell skill like F**** !! I am so happy Level skill under beginner HAHA well i am just getting what i want but now i got a question about autoit + powershell When i run that Shellcommand $iPid = run("Powershell Get-ADUser USER -Properties * | select -Expand Title" , @WindowsDir , @SW_HIDE , 0x2) The return valu is : Micro r,seau (this is normal in PowerShell) Can i transform the value Micro réseau with autoit
  10. Hey Guys, I am almost there but feel I am missing something that is right in front of me and need another set of eyes. I am trying to run the following powershell file with the following parameters. This works in powershell just fine. Reset-LocalAdminPassword.ps1 -Password $secureString I created an autoit script to do a few other things but from venturing in the forums I found some code and did the following: ;THIS COMMAND WILL RUN THE powershell script $iDir = "C:\test\script\Reset-LocalAdminPassword.ps1" Run('cmd /k C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File ' & '"' & $iDir & '-Password $secureString') Sleep(15000) The problem is that when it runs it gives me a message that C:\test\script\Reset-LocalAdminPassword.ps1-Password $secureString' is not a valid ps1 file. I cannot seem to get it to run the ps1 file with the -Password $secureString' parameter. It keeps cobining the ps1 path and the parameters all as one. I am sure this is something I am overlooking but I have been battling with this for a few hours now and just don't know what I am missing.
  11. Hi experts. I'm trying to get this to work: https://www.autoitscript.com/forum/topic/173949-using-the-autoit-powershell-cmdlets/ but I get an error: error: syntax error (illegal character) "Import-Module .\" Can anyone help me?
  12. Remove Windows Apps for All Users

    I have messed with this time to time, but recently decided to go ahead and push it out because I have so many people having the default reader app take over adobe and since they are not admins they cant easily change the default program to adobe for their profile. To remove the app for the current user I use. get-appxpackage | where name -like '*reader*' | remove-appxpackage If it is a new computer build I can remove the app from the system so it does not install for any new users with this. get-provisionedappxpackage -online | where displayname -like '*reader*' | remove-appxprovisionedpackage -online So where I am stuck is getting it off existing accounts on computers in the field. Every article, document, etc I can find says all you need to do is add the -allusers flag. If I add the flag to the get package part it does show the package for each user, but when I pipe it into the remove-package cmdlet I get an error that the package is not installed for the current user and it does not uninstall it for any other account. This is what I have tried: get-appxpackage -allusers | where name -like '*reader*' | remove-appxpackage Also a revision of it get-appxpackage -allusers *reader* | remove-appxpackage As far as I can tell, this is correct but simply is not working. Any ideas or anybody know what the key issue that I am overlooking is?
  13. I'm running AutoIT v3.3.14.2 on Windows 10 ver 1511. The September Cumulative Update from Microsoft has broken the way some third party credential providers work. You can see more detail here: https://www.novell.com/support/kb/doc.php?id=7018051 So I want to automatically and silently remove this update from all our machines. In Windows 7 I could easily do it with this: wusa.exe /uninstall /kb:3185614 /quiet But apparently Microsoft has taken away the /quiet switch functionality in Windows 10. wusa /? will show that the switch is there, but when trying to use it error 87 (invalid parameter) is returned. So I relented on that point and decided to run wusa without the quiet switch. It pops up a child window that prompts for confirmation before uninstalling the update. Sounds like a perfect job for AutoIT, right? Except I can't get the button to click, either using ControlClick or ControlSend or Send. I can select it by sending the {Alt} key to it and it highlights. But I just can't get it to accept the click or {Enter}. I then tried using Powershell and DISM to remove the package, but this is a hotfix and doesn't have a package name, so I can't use dism /remove-package, either. Does anybody have any other ideas how this can be done silently?
  14. I have a rather heady PowerShell script that requires a few inputs that I would like to present as pick lists/pull down lists. I've fiddled with doing this using Windows API calls and frankly it's pretty ugly and non-productive. What I'd like to accomplish is to present the user with a refined UI that will force them to color between the lines and catch any error putput and display it to them in an organized fashion. Has anyone done this? I'd like to have an AutoIT based solution as my current client didn't plan on any extra time or budget to accomplish this task. Thanks, -Scott.
  15. #include<array.au3> _ArrayDisplay(_GetCertByThumb("")) ;~ "A1B9894B9BB100F43A229D65CC3C306FBF0BB9F8" Func _GetCertByThumb($sThumbprint = "") $sCommands = 'Powershell get-childitem -Path Cert:\CurrentUser -Recurse -Name | FindStr /L "\\"' & $sThumbprint $iPID = Run(@ComSpec & " /c " & $sCommands, "", @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aRtn = stringsplit($sOutput , @LF , 2) _ArrayDelete($aRtn , ubound($aRtn) - 1) If ubound($aRtn) < 1 then _ArrayAdd($aRtn , "No Match Found") Return $aRtn EndFunc
  16. I'm having a heck of a time trying to figure out how to call/invoke a WMI method through Autoit. I have a Powershell script that checks if a reboot is required using multiple checks including a WMI method related to ConfigMgr/SCCM but I want to do this in Autoit because I have a script that does other things and prompts the user to reboot if needed. I've given up on trying to make Autoit run the Powershell script and capture the true/false return value so since I know how to do everything the Powershell script does in Autoit, minus this WMI method call, I figured I'd take a stab at doing all of it in Autoit. The WMI method involved is called DetermineIfRebootPending in the root\ccm\ClientSDK namespace in the CCM_ClientUtilities class. I've done some searching on the forums here and saw many references to the Scriptomatic so I downloaded that and when I run it, since (I'm guessing) there are no properties in the CCM_ClientUtilities class, it doesn't show up as an available option in the class dropdown (see attached image), so it doesn't seem like Scriptomatic is going to help me here unless I'm missing something. Here is the Powershell part that I'd like to convert to Autoit. $CCMClientSDK = $null $CCMSplat = @{      NameSpace='ROOT\ccm\ClientSDK'      Class='CCM_ClientUtilities'      Name='DetermineIfRebootPending'      ComputerName=$ComputerName      ErrorAction='SilentlyContinue' } $CCMClientSDK = Invoke-WmiMethod @CCMSplat If ($CCMClientSDK.IsHardRebootPending -or $CCMClientSDK.RebootPending) {      $SCCMReboot = $true } So as you can see, its invoking the DetermineIfRebootPending method and then checking the IsHardRebootPending and RebootPending properties to see if they are True or False. If either are true, it sets the $SCCMReboot to true and later on down the script, it returns that value to the pipeline after checking some other registry locations to determine if reboot is required. If anyone could help me either 1) convert the above code to Autoit or 2) figure out how to run the powershell script from within Autoit and capture the return value, I'd be forever grateful. Thanks!
  17. Hi, I would like to install chocolatey packages (OneGet) via Autoit. Manually without Autoit I would just open Powershell and use this command: Install-Package -Name Firefox -Force It also works with cmd (see attachment 1) powershell.exe -Command Install-Package -Name Firefox -Force With Autoit I tried the following code: RunWait(@ComSpec & ' /k ' & 'powershell.exe -Command Install-Package -Name Firefox -Force', @SW_SHOW) It doesnt work at all. I don't even see a cmd window. When I add @SystemDir the Windows appears with the error in attechment 2. Is there another way to run PowerShell Commands with Autoit? I would like to avoid starting Powershell, waiting for the window, sending the command and sending Enter. Thanks Eggsplorer
  18. Message is broken out further and requires extra massaging, that and I am formatting it for eventual Neo4j graph sexiness. #include <AutoItConstants.au3> #include<array.au3> #RequireAdmin $outfile = "test_PS_csv_failures.csv" If fileexists($outfile) then FileDelete($outfile) $iPID = run("powershell get-eventlog -logname security -Message '*An account failed to log on*' | select Index,TimeGenerated,Message | format-list" , "", @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aStr = stringsplit($sOutput , @CRLF , 3) For $i = ubound($aStr) - 1 to 0 step - 1 If NOT stringinstr($aStr[$i] , ":") Then _ArrayDelete($aStr , $i) Next ;~ _ArrayDisplay($aStr) $sFinal = "" $sLine = "" $k = 0 for $i = 0 to 29 $sLine &= stringregexpreplace(stringstripws($aStr[$i] , 8) , "(\:.*)" , "") & "," next $sFinal &= StringTrimRight($sLine , 1) & @LF $sLine = "" for $i = 30 to ubound($aStr) - 1 $aStr[$i] = stringreplace($aStr[$i] , "," , "_") $sLine &= stringregexpreplace($aStr[$i] , "(\A.*\D:)" , "") & "," $k += 1 If $k = 30 Then If NOT StringInStr($sLine , @UserName) Then $sFinal &= StringTrimRight($sLine , 1) & @LF $sLine = "" $k = 0 EndIf next ;~ msgbox(0, '' , $sFinal) filewrite($outfile , $sFinal) shellexecute($outfile)
  19. Is there a way to be able to filter like power can filter? Like the way this powershell script filters for instance: Import-Module ActiveDirectory Get-ADUser -Filter {EmailAddress -eq "$Usersemailaddress"}| Select-Object -ExpandProperty SamAccountName | Out-File C:\Users\"$env:username"\Desktop\email2samconversion.txt Goal is trying to get the SamAccountName by filtering with the email address of a user in AD. I have the AD.UDF but it only works with the Sam and the FQDN. i've tried running powershell in Autoit, but it takes at least 7 seconds to start Powershell>import the module>create the text file>read the text file>Delete the textfile from desktop>Display in Edit box in GUI. I'm wondering if there is a way to filter the search function of AD through autoit kind of like how Powershell does. i've not yet been able to powershell to run properly in Autoit either: I tried: Run(powershell -Command Import-Module ActiveDirectory | Get-ADUser -Filter {mail -eq "$UserEmail"} | Select-Object -ExpandProperty SamAccountName | Out-File C:\users\$env:username\desktop\SamaccountNametextfile.txt") But it keeps failing. I tried using ShellExecute as well and neither of them worked.
  20. I need a function where it will get a string as parameter which will of syntax in VBScript like below a&"asdasd"&asd&"as&dsf&gdf"&fs Here in the above string what ever in the quotes we shouldn't replace them as they are taken as normal strings.And if the ampersand(&) if outside the quotes then we need to replace them with plus(+).And the normal words which are outside the quotes we need to append them with $. So the output will be as below. $a+"asdasd"+$asd+"as&dsf&gdf"+$fs. Can you please help me on this.I'm unable to differentiate with & in the quotes and outside the quotes. Don't know how to check whether a string is in quotes or not.
  21. Hello Everyone, I was just made aware of the free PowerShell App Deployment Toolkit and wanted to share it here. One could fairly easily customize this toolkit by adding the AutoItX DLL/COM control to it thereby utilizing the AutoIt PowerShell CmdLets making it a complete solution for all types of deployments! Regards, TXTechie
  22. When creating my OS master image as the last step I run the Disk Cleanup tool to get rid of the old versions of Windows Update files and temp files created during the build. On Windows 10 this also can be used to cleanup the 100MB of "Retail Demo Content" that is present Microsoft Support has this article on how to automate Disk Cleanup. It's not as simple as adding some command-line switches. You have to manually run it once with /sageset:nn, then select the items you want to clean. This creates some registry keys and thereafter you can run it with /sagerun:nn (where nn is the same number) and it will clean those items. Not ideal when you want to run it as a "one-off". This PowerShell script automatically creates all the relevant registry keys, runs Disk Cleanup, then deletes the keys. <# .SYNOPSIS Automates the Disk Clean tool to clean up all possible items for the given OS. #> # V2 admin check If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "Please run this script as an Administrator!" Exit 1 } # Create reg keys $volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches" foreach($key in $volumeCaches) { New-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Value 2 -Type DWORD -Force | Out-Null } # Run Disk Cleanup Start-Process -Wait "$env:SystemRoot\System32\cleanmgr.exe" -ArgumentList "/sagerun:99" # Delete the keys $volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches" foreach($key in $volumeCaches) { Remove-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Force | Out-Null }
  23. I'm writing some build scripts for a Windows 10 build. One thing I want to do is optimise the build for a business desktop. And that means removing all the "toy" Windows Store apps that are reinstalled every time a new user is logged on. Zune Music - I'm looking at you. AppX packages are staged or provisioned in the Windows 10 image, and also installed per user as required. The PowerShell CmdLets are named Get-AppXProvisionedPackage and Get-AppXPackage respectively. To get a list of packages installed for the current user we run: Get-AppxPackage | Format-Wide -Property NameHere is the list returned by Windows 10 Enterprise: Microsoft.VCLibs.140.00 Microsoft.VCLibs.140.00 Microsoft.NET.Native.Framework.1.0 Microsoft.NET.Native.Framework.1.0 Microsoft.NET.Native.Runtime.1.0 Microsoft.NET.Native.Runtime.1.0 Microsoft.Windows.CloudExperienceHost Microsoft.AAD.BrokerPlugin Microsoft.Windows.ShellExperienceHost windows.immersivecontrolpanel Microsoft.Windows.Cortana Microsoft.AccountsControl Microsoft.BioEnrollment Microsoft.LockApp Microsoft.MicrosoftEdge Microsoft.Windows.AssignedAccessLockApp Microsoft.Windows.ContentDeliveryManager Microsoft.Windows.ParentalControls Microsoft.WindowsFeedback Microsoft.XboxGameCallableUI Microsoft.XboxIdentityProvider Windows.ContactSupport Windows.MiracastView Windows.PrintDialog Windows.PurchaseDialog microsoft.windowscommunicationsapps Microsoft.BingFinance Microsoft.BingWeather Microsoft.BingNews Microsoft.Getstarted Microsoft.Windows.Photos Microsoft.WindowsStore Microsoft.XboxApp Microsoft.WindowsCamera Microsoft.ZuneMusic windows.devicesflow Microsoft.WindowsAlarms Microsoft.SkypeApp Microsoft.ZuneVideo Microsoft.WindowsSoundRecorder Microsoft.WindowsPhone Microsoft.WindowsMaps Microsoft.WindowsCalculator Microsoft.People Microsoft.Office.OneNote Microsoft.MicrosoftSolitaireCollection Microsoft.MicrosoftOfficeHub Microsoft.BingSports Microsoft.Appconnector Microsoft.3DBuilderIt's interesting that some of the old desktop applications have been replaced by Universal AppX packages. For example, Windows Calculator. The list above just includes the AppX package name, there are more properties available: Get-AppXPackage Microsoft.WindowsCalculatorName : Microsoft.WindowsCalculator Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US Architecture : X64 ResourceId : Version : 10.1507.15010.0 PackageFullName : Microsoft.WindowsCalculator_10.1507.15010.0_x64__8wekyb3d8bbwe InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1507.15010.0_x64__8wekyb3d8bbwe IsFramework : False PackageFamilyName : Microsoft.WindowsCalculator_8wekyb3d8bbwe PublisherId : 8wekyb3d8bbwe IsResourcePackage : False IsBundle : False IsDevelopmentMode : False Dependencies : {Microsoft.VCLibs.140.00_14.0.22929.0_x64__8wekyb3d8bbwe} Once you have package names you can use Remove-AppXPackage to uninstall for the user, and Remove-AppXProvisionedPackage to remove from the image, then you run SysPrep and the applications will not be installed for new users of that image. Most of the package names are fairly self explanatory, but each package can contain multiple applications. It's not obvious that the "toy" Windows Mail application is included in the microsoft.windowscommunicationsapps package. Here is a PowerShell script that cycles through all the packages and shows the applications inside: $packages = Get-AppxPackage foreach ( $package in $packages ) { Write-host "Package: $($package.Name)" $manifests = Get-AppxPackageManifest -Package $package foreach ($manifest in $manifests) { foreach($app in $manifest.Package.Applications.Application) { Write-Host " Id: $($app.Id)" Write-Host " Executable: $($app.Executable)" } } Write-Host }Example output for microsoft.windowscommunicationsapps: Package: microsoft.windowscommunicationsapps Id: microsoft.windowslive.mail Executable: HxMail.exe Id: microsoft.windowslive.calendar Executable: HxCalendarAppImm.exe The Id gives you a good idea of the individual applications, but I imagine there is a way to get the proper Start Menu display name. Need to do a little more digging though.
  24. I'm not familar with popweshell ,could someone help me translate the code below to autoit ? thanks in advance. $priPath = $args[0] $outputPath = $args[1] $replacementPath = $args[2] $ErrorActionPreference = "Stop" $inputStream = [System.IO.File]::OpenRead($priPath) $outputStream = [System.IO.File]::Create($outputPath) $replacementStream = [System.IO.File]::OpenRead($replacementPath) $inputReader = New-Object System.IO.BinaryReader -ArgumentList $inputStream $outputWriter = New-Object System.IO.BinaryWriter -ArgumentList $outputStream $inputStream.CopyTo($outputStream) $replacementLengthAligned = ([Math]::Ceiling($replacementStream.Length / 8) * 8) # header $inputStream.Seek(0x14, "Begin") | Out-Null $headerLength = $inputReader.ReadUInt32() $inputStream.Seek(0xB8, "Begin") | Out-Null $dataitemOffset = $inputReader.ReadUInt32() $origDataitemLength = $inputReader.ReadUInt32() $dataitemLength = $origDataitemLength + $replacementLengthAligned $outputStream.Seek(0xBC, "Begin") | Out-Null $outputWriter.Write([int]$dataitemLength) # dataitem $outputStream.Seek($headerLength + $dataitemOffset + 0x18, "Begin") | Out-Null $outputWriter.Write([int]$dataitemLength) $inputStream.Seek($headerLength + $dataitemOffset + 0x24, "Begin") | Out-Null $stringCount = $inputReader.ReadUInt16() $blobCount = $inputReader.ReadUInt16() $origDataLength = $inputReader.ReadUInt32() $outputStream.Seek(0xC, "Current") | Out-Null $outputWriter.Write([int]($origDataLength + $replacementLengthAligned)) $outputStream.Seek($stringCount * 4, "Current") | Out-Null for ($i = 0; $i -lt 10; $i++) { $outputWriter.Write($origDataLength) $outputWriter.Write([int]$replacementStream.Length) } $outputStream.Seek(($blobCount - 10) * 8, "Current") | Out-Null # data $outputStream.Seek($origDataLength, "Current") | Out-Null if ($outputStream.Length - $outputStream.Position -ne 0x18) { Write-Error "Not compatible with this PRI file." } $replacementStream.CopyTo($outputStream) # footer $outputStream.Seek($replacementLengthAligned - $replacementStream.Length, "Current") | Out-Null $outputWriter.Write(0xDEF5FADE) $outputWriter.Write([int]$dataitemLength) $outputWriter.Write(0xDEFFFADE) $outputWriter.Write(0x00000000) $outputWriter.Write([char[]]"mrm_pri2") $outputStream.Seek(0xC, "Begin") | Out-Null $outputWriter.Write([int]$outputStream.Length) $outputStream.Seek(-0xC, "End") | Out-Null $outputWriter.Write([int]$outputStream.Length) $inputReader.Close() $outputWriter.Close() $replacementStream.Close()
  25. *Requires that you are a client of SCCM in order for SMS_ to exist/populate This is an exercise in formatting data returned from CIM via powershell via Autoit. Should get you the meat: name, version, location, installdate, and uninstall string. Short Version: Grouped by Program #RequireAdmin #include<Array.au3> $iPid = run("powershell (Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | fl ProductName,InstallDate,InstalledLocation,ProductVersion,UninstallString | out-string).trim()", "" , @SW_HIDE , 0x2) $sOutput = "" While ProcessExists($iPid) $sOutput &= StdoutRead($iPID) WEnd $aOutput = stringsplit($sOutput, @LF , 2) _ArrayDisplay($aOutput) Long Version: Each Category in its own column, modular pieces. ;CIMClasses #include<Array.au3> #RequireAdmin $iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select ProductName" , "" , @SW_HIDE , 0x2) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aProductName = stringsplit($sOutput , @CR , 2) ;;;;;------------------------------------------- $iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select InstallDate" , "" , @SW_HIDE , 0x2) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aInstallDate = stringsplit($sOutput , @CR , 2) ;;;;;------------------------------------------- $iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select InstalledLocation" , "" , @SW_HIDE , 0x2) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aInstalledLocation = stringsplit($sOutput , @CR , 2) ;;;;;------------------------------------------- $iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select ProductVersion" , "" , @SW_HIDE , 0x2) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aProductVersion = stringsplit($sOutput , @CR , 2) ;;;;;------------------------------------------- $iPid = run("powershell Get-CimInstance -Namespace root\cimv2\sms -ClassName SMS_InstalledSoftware | select UninstallString" , "" , @SW_HIDE , 0x2) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd $aUninstallString = stringsplit($sOutput , @CR , 2) ;;;;;------------------------------------------- Local $aOut[ubound($aProductName)][5] For $i = 0 to ubound($aProductName) - 1 $aOut[$i][0] = $aProductName[$i] $aOut[$i][1] = $aInstallDate[$i] $aOut[$i][2] = $aInstalledLocation[$i] $aOut[$i][3] = $aProductVersion[$i] $aOut[$i][4] = $aUninstallString[$i] Next _ArrayDisplay($aOut , "SMS Installed Software")
×