Questions tagged [powershell]
An interactive shell, scripting and programming language, and surrounding environment from Microsoft. Commonly used by system administrators managing Microsoft software (including Windows, Exchange, SharePoint, and cloud services Azure and Office 365), PowerShell is included by default with Windows, and takes over from previous languages such as VB Script.
4,130
questions
0
votes
0
answers
274
views
Powershell Foreach Statement not working in AD when combined with Get-ChildItem
Good Afternoon,
I am attempting to count how many objects are in 9 different OU's which is in an OU for my organizations DC. This list will specifically return only the amount of objects (computers ...
5
votes
1
answer
1k
views
How to assign a Windows service least privileges to provision new accounts
We have a Windows service which currently runs as LOCAL_SYSTEM - effectively a local administrator. One of the functions of the service is to provision new local accounts and add them to a specific ...
0
votes
2
answers
888
views
Using Powershell Compress-Archive for folders in C:\Program Files
Trying to compress a folder in the C:\Program Files using Powershell however getting the following error. Appreciate if anyone can help.
Command:
powershell.exe -nologo -noprofile -command Compress-...
1
vote
2
answers
6k
views
Powershell (Get-ADUser -identity).someproperty not showing result
I am trying to search for individual properties of an AD-User, when I run
(Get-ADUser $userName).$targetProperty
I get nothing
When I run
Get-ADUser $userName | select $targetProperty
I get the ...
0
votes
2
answers
1k
views
'unlock-adaccount' is not recognized in Powershell on Server 2012 r2
I'm trying to use Unlock-ADAccount in a powershell script running on a Windows Server 2012 R2 box. This is what I get:
PS C:\> unlock-adaccount
unlock-adaccount : The term 'unlock-adaccount' is ...
1
vote
1
answer
81
views
Need to delete files (*.log.*) from subdirectories which has same name scattered in many root directory
I need to delete logs with extension *.log.* exits in subfolder named SessLogs, WorkflowLogs under the root directory d:\software\Bil
Likewise I have the folders SessLogs, WorkflowLogs in many ...
1
vote
0
answers
881
views
MD5 hash comparison over SMB SLOW
I'm scripting a full backup solution in powershell on Windows server 2016 for Hyper-V VM's and have run into the issue that calculating the MD5 hash over the network on a mounted network drive across ...
7
votes
1
answer
2k
views
Used PowerShell to change my RHEL root passwords via PuTTY, but I don't know what I changed my password to
Basically the title. My friend provided me a script to batch change RHEL passwords via Powershell and PuTTY, but the new password I entered doesn't work when I try to log in. I think the issue is that ...
2
votes
0
answers
487
views
kubectl (version v1.15.0) on windows is not able to display the tabular output using 'get' command with default content type
kubectl version v1.15.0 was not able to list the pods (and other resources) in tabular form of content type using 'get' command.
kubectl get pods
Error from server (NotAcceptable): the server was ...
0
votes
0
answers
287
views
Using powershell to track process spawned by .bat file
I have a third party application that uses .bat batch files to kick off their java applications. (It's pentaho, but not sure that matters much for what I'm doing).
I'd like to be able to get a hold ...
0
votes
2
answers
238
views
How to run aws after installing awscli
Here are the code in powershell script I run to provision a Windows 2012 server on an ec2 instance:
# Set up chocolately
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net....
0
votes
1
answer
513
views
How to automate the installation of .net framework 3.5 with terraform and powershell?
The operating system is Windows Server 2012.
This dialog box pops when a process starts on the server.
Is it possible to automate the installation of the feature?
2
votes
3
answers
13k
views
Add-ADGroupMember : Cannot find an object with identity: '{DistinguishedName}' under: 'DC=DOMAIN,DC=ORG,DC=com'
I have already browsed multiple versions of this question and the various solutions given on this and other sites, but none have addressed my issue or why it might be occurring.
I am trying to create ...
3
votes
1
answer
4k
views
Execute Script using Powershell Install-Package
currently I am trying to install software using Windows Package Management from a local repository. Right now I am using the nuget provider to get the package. My problem is, that I want to execute a ...
0
votes
1
answer
2k
views
task scheduler powershell foreground
I am using windows server 2016 "scheduled tasks" to run a powershell script.
For some reason, i would see the script run in foreground , and not in background.
Any idea to resolv this ?
Thanks
5
votes
1
answer
3k
views
Configuring Storage Spaces for NVMe caching of SSDs using powershell
I am installing Server 2019 Core on a Dell server. These are the drives I have:
Get-StoragePool -IsPrimordial $true | Get-PhysicalDisk | Where-Object CanPool -eq $True
DeviceId FriendlyName ...
0
votes
1
answer
5k
views
Powershell send-mailmessage logs
I need to debug Send-MailMessage command. In linux, I can see the logs of sending mail, via tail -f. There is an option to see the logs of this command? I want to send mail to an external domain, it ...
5
votes
4
answers
22k
views
How do I get the DNS server cmdlets to work on PowerShell in Windows 10?
When I try to use a DNS cmdlet, I get a "not recognized" error...
PS C:\Users\josh\Documents\GitHub\GoDaddy> get-dnsserverresourcerecord
get-dnsserverresourcerecord : The term 'get-...
1
vote
0
answers
455
views
powershell echo and function parameters
I've discovered some weird behaviour with echo and function parameters - in this example:
function a
{
$one = "1"
echo "display some text"
return @{one = $one}
}
function b
{
param ($...
1
vote
1
answer
46
views
Auto-Detect the Silent Switches for Executable
In our environment, we are trying to automate the process of Unattended/Silent Installation for EXE's.
I would like to know, is there a way to auto-detect the silent switches for executables. Is there ...
0
votes
1
answer
195
views
schtasks command has an unclear error
I am trying to change the expiry date of an Scheduled task using powershell because there are more than 40 tasks for users of same thing.
schtasks.exe /Change /tn "Cache USer" /u "mydomain\...
2
votes
2
answers
3k
views
How to find Dell firmware versions through powershell
Looks like my newer servers are immune to this:
#Get-WmiObject -Namespace root\CIMV2\Dell -Class Dell_CMApplication -Filter "componentType = 'FRMW'" -ComputerName "localhost" | Select name,version
...
0
votes
1
answer
116
views
Script to automate data population once windows VM in GCP started
I need to know if there is any way I can build a script which can be executed as soon as my windows VM is started in GCP. This script should(Other than RPA solution) be able to open a web browser and ...
0
votes
2
answers
151
views
Basic Powershell script strange behaviour
I have small script. Which i want test it with "If, else statement".
I have the same value variables but when try to compare it, it gives else condition, but it should give true condition.
Below are ...
1
vote
0
answers
447
views
Modify dynamic distribution lists in a bulk - Exchange
We have a situation here. So, basically our users right now are in the group abc>users will be migrated to a new OU like abc>country>users. This will affect several dynamic distribution groups with ...
1
vote
3
answers
9k
views
Get-HotFix not returning all installed KBs
I'm having trouble with the Get-HotFix command on a Windows Server 2012 not returning all installed KBs, compared to what Windows Update says is actually installed on the server when querying it.
Get-...
2
votes
1
answer
400
views
Powershell Importing active directory groups from a CSV file fails
I have a list of groups in CSV exported from a domain to be imported onto another domain. The destionation domain already has the same OUs and so (it is a test domain). The CSV file contains group ...
0
votes
1
answer
7k
views
o365 - Unable to delete items from mailbox
a user is not able to delete items from his mailbox . I have tried to force this by running command. I have tried this both OWA and Outlook. unfortunately no luck.
Start-ManagedFolderAssistant -...
1
vote
0
answers
520
views
Using powershell can a non-admin user, change password of a user of remote machine which has windows operating system if existing password is known?
I have 2 machines. From machine A i log in as a user without admin privileges. I need to change the password of another user say BUser who is administrator in machine B by providing the existing old ...
0
votes
1
answer
2k
views
PowerShell - Get VMName, VMNetworkAdapter, SwitchName,IsLegacy, Vlanlist
So far I've figured out that piping these cmdlets will get me everything I need EXCEPT for the "VLANLIST"
Get-VM | Get-VMNetworkadapter | ft VMname,NAme,SwitchName,isLegacy -Autosize
I would be ...
0
votes
0
answers
362
views
Move-Item script failed with missing files
I have a script below that is intended to move zip files from the source directory to target (both are network shares). The script was executed and we now have zip files missing in both the target ...
3
votes
1
answer
867
views
Windows SMTP: Script Outbound Security
Building a config script in PowerShell to configure web servers' SMTP service to use the AWS SES (simple email service) for outbound mail delivery. Easy to do manually, but as we enter a load-balanced ...
3
votes
1
answer
11k
views
Logging when ApplicationPool is started/stopped via Powershell
I use a Powershell script to, among other things, start and stop an IIS Application Pool via the following commands:
Stop-WebAppPool -Name $appPoolName;
Stop-WebAppPool -Name $appPoolName;
Is there ...
0
votes
1
answer
1k
views
Migrate user mailbox calendar to public folder (shared calendar) in Exchange
We use Exchange 2016. A user shares his calendar with other users through Outlook (2010, 2013). To decouple this calendar from his mailbox and make it a shared calendar, we want to port it to a public ...
1
vote
1
answer
5k
views
Startup Powershell script in GPO not executing - Windows Server 2016
I'm trying to get a simple Powershell script to run as a GPO Startup script on my school's workstations. So far I've not had much luck. The script started life as a more involved set of commands ...
0
votes
1
answer
257
views
Script to remote into multiple workstations
I currently have multiple training labs with 10-15 computers in each. The problem is they all don't get used that often and after 60 days of inactivity, the computer gets blown from the domain and ...
0
votes
1
answer
115
views
Powershell not loading CSV values
I wonder if someone can give me some guidance on a power shell script as i'm new to it.
I have been tasked with renaming some machines that are not domain joined and so I have written the below, to ...
0
votes
1
answer
2k
views
how to connect to server in remote domain with winrm
I have winrm enabled on a remote server and from a member of that server's domain, I am able to run Powershell commands using PSSession. However, from a client in another domain, I get "Connecting to ...
0
votes
1
answer
1k
views
Installing Module during OSD Task Sequence from NuGet not found
I have an OSD task sequence which one of the steps runs a package containing the PowerShell DSC '.ps1' file and the '.MOF' configuration. Now during the task sequence it looks like it can't find the ...
1
vote
1
answer
144
views
DSC not pulling config
my DSC node is not pulling the DSC config from my SMB DSC server. Get-DSCConfigurationStatus says the pull was successfull but Get-DSCConfiguration remains the same(old config).
Im testing it with a ...
1
vote
0
answers
67
views
DSC switching back to push
Hi there i got a small problem. I have configured a node to pull the config from my HTTP DSC server. But once it pulls its config the node switched back to push.
My node config looks like this:
[...
1
vote
1
answer
502
views
seach-mailbox group mailbox
How do you search a group mailbox.
Search-Mailbox -Identity "[email protected]" -SearchQuery 'Subject:"Hello"' -TargetMailbox [email protected] -TargetFolder "Inbox"
When I try to search the group mailbox ...
-1
votes
1
answer
760
views
How to set Starting program section and Remote control section by powershell for AD user
I have used the "New-ADUser" command to create a batch of new user.
However, I need to set the "Program file name" in "Starting program" to "c:\windows\system32\logoff.exe" and "Start in" to "c:\...
0
votes
1
answer
303
views
Unable to select fields on Get-ADGroupMember query
I am trying to grab a list of users and their descriptions/departments, who are in a certain AD Security Group using the following command:
Get-ADGroupMember -Identity "SecurityGroup" | select ...
0
votes
1
answer
220
views
"PowerShell Job not supported in Managed instance"
DMA assessment report tells "PowerShell Job not supported in Managed instance" . There are SQL server agent purge jobs to erase system phantom records job step in power shell . How this issue can be ...
1
vote
0
answers
212
views
Windows Updates not downloading when set to Download Only
I am running Windows server 2016, with Windows Updates set to Download Only, however when I run the following script, it shows all outstanding updates as not downloaded, how do I investigate why they ...
0
votes
1
answer
1k
views
Exchange Management Shell cmdlet not found
I just recently installed an Exchange 2019 environment as we are planning to migrate from IBM Domino to Microsoft Exchange.
Ever since creating a Database Availability Group some menu items are ...
1
vote
1
answer
3k
views
how to check if network discovery is on using powershell?
I have just built a new server - windows server 2016
when trying to access its c: drive from any other server I was getting this error:
The I changed this settings:
and all is working fine.
...
1
vote
2
answers
960
views
SCCM PowerShell - Run Invoke-CMWmiQuery against a specific device collection?
I have the following WQL query:
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client ...
0
votes
1
answer
226
views
Multiple values returned with GetDwordValue .uvalue
On a few systems I have GetDwordValue return duplicate values (.uvalue)
The commands are
$reg=Get-WmiObject -List -Namespace root\default -ComputerName $ip.ipaddress | Where-Object {$_.Name -eq "...