Spiceworks » PowerShell
177 FOLLOWERS
The PowerShell forum for IT pros to share scripts, get assistance with commands, or ask for help with anything PowerShell related.
Spiceworks » PowerShell
1M ago
I need to create a powershell script that will install Autodesk Web And Mobile's MSI contents into all users logged into a machine's Appdata folder.
After installing the MSI it will only install to local profiles at this location
This folder: "Autodesk Save to Web and Mobile bundle"
needs to be installed to:
C:\Windows\users\JohnSmith\AppData\Roaming\Autodesk\ApplicationPlugins
Unfortunately it seems it needs to be done this way as there is no way to install this onto Programdata\Autodesk\AutodeskPlugins via the MSI.
Help with getting started or a solution is appreciated.   ..read more
Spiceworks » PowerShell
1M ago
I've done around 5 online free "courses" now and they all cover the bare bones, basic same points of Powershell that I'm not finding helpful. I've even paid for two and it all covers the same stuff.....
"Look, it's a command line!" and "Here's how to make "dir" look different and in green text!" just all complete vapid nonsense that isn't teaching anything for the first 10 videos, then barely covers scripting.
Does anyone know of more comprehensive, VERY detailed courses for this? If I can learn Powershell in 4 months enough to make some automation scripts, I can get this Engineer position at ..read more
Spiceworks » PowerShell
1M ago
Good afternoon folks.
I am trying to run an LDAP query against a Domain Controller to include servers with the following requirements:
OperatingSystem=*server* (To include all Servers)
OR
OperatingSystem=*Enterprise* (To include Windows 10 Machines)
AND
Machine isNOT disabled.
If I run the following, I get what I need for servers:
Powershell
Get-ADObject -searchbase "DC=DOMAIN,DC=LOCAL" -ldapfilter "(&(objectclass=computer)(operatingSystem=*server*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" | Sort-Object Name
If I run the following, I get what I need for the Windows 10 Enterpr ..read more
Spiceworks » PowerShell
1M ago
Hi,
I have an 2 arrays added to a hashtable, and I want to loop through each item individually but can't seem to.
I could not find how to access an individual array item in the hashtable. In this case I'm trying to loop through DC1, then have its items iterated, then DC2 and have its items iterated as below.
Text
DC1 : NW1 DC1 : NW2 DC2 : NW3 DC2 : NW4 DC2 : NW5
When I try the below it returns all values of the array in 1 go.
Text
$hash = @{ DC1 = @("NW1", "NW2"); DC2 = @("NW3", "NW4", "NW5"); } foreach($key in $hash.Keys){ Write-Host "$key : $($hash[$key])" }
Result
Text
PS C:\Users ..read more
Spiceworks » PowerShell
1M ago
I hate having to figure out which IIS logfiles belong to which website. I normally don't have the time to look for the site ID to figure out which W3SVC12345678 folder is the right one. To get around this, I wrote a script years ago to not only move the IIS logfiles off the system drive, but to also rename them with the actual site name. As I said I wrote this years ago at another company, and I've used it where I am now on four SharePoint farms just two years ago. We just did a tech refresh and SharePoint consolidation, and I used my script again. Now it seems that It will only do one, occasi ..read more
Spiceworks » PowerShell
1M ago
Assume I want to call (from wrapping DOS BATCH SCRIPT) a powershell script.
Therefore i wrote inside the .bat script:
Text
Powershell.exe -noprofile -noexit -command "& {D:\tmp\testargs.ps1 %args%}"
It works.
However if the path to the .ps1 powershell script contains blank or ampersands I get errors:
Text
Powershell.exe -noprofile -noexit -command "& {D:\this is the path\with blanks inside\testargs.ps1 %args%}"
If I try to enclose the full path to the ps1 script in double or single quotes it doesn't work either
Text
Powershell.exe -noprofile -noexit -command "& {'D:\this ..read more
Spiceworks » PowerShell
1M ago
Powershell
I have 2 test users I am using this on and it seems to only pull the $Initial of the first user in the group. But the rest seems to execute just fine. So the first user is John Dutton, the second is Luke Test. I successfully get jdutton@domain.com however Luke Test gives me Jtest@domain.com
Powershell
$Domain = 'domain.com' $Users = Get-ADUser -Filter * -SearchBase "dc=domain,dc=local" -Properties GivenName,Surname foreach ($User in $Users){ [string]$FirstName = $Users.GivenName [string]$Initial = $FirstName.Substring(0,1) [string]$LastName = $User.Surname $CustomAttribute1 ..read more
Spiceworks » PowerShell
1M ago
Assume I have a powershell script foobar.ps1.
I want to call another, external cmdline program (not powershell script) from inside this script (and pass some arguments).
example:
“D:\tools\exiftool.exe” -n “D:\test\sample.jpg”
How can I implement this call?
The calling powershell script should NOT wait for end of execution of the external program but immediately continue with the next statement (even if the called program returns some result (code))
Text
“D:\tools\exiftool.exe” -n “D:\test\sample.jpg ..read more
Spiceworks » PowerShell
1M ago
Hi all,
I'm trying to get a list of installed software on the systems in our network and found the following howto:
https://community.spiceworks.com/how_to/193125-listing-installed-software-on-multiple-computers
Which resulted in me making the following Powershell script:
Get-Content -Path c:\temp\pcs.txt | ForEach-Object { Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Product -Computer $_ } | Export-CSV “c:\Temp\Software\InstalledAppsWmi.csv” -Append -NoTypeInformation
I ran it on my local machine and got a csv with installed applications. To make sure this is working wel remotely over ..read more
Spiceworks » PowerShell
1M ago
Hello
Can anyone let me know a PowerShell script to one move the start bar to the right like windows 10
Remove pinned apps as this is just bloat software
Remove widgets as they do not provide any benefit to the business.
I will be rolling out windows 11 with either MDT or manage engine OS deploy ..read more