All Questions
257
questions
0
votes
1
answer
37
views
Custom Script-based Backups
I'm a believer in having multiple restore solutions in place for the environment I support.
I have a production backup solution for my Windows Server environment. It includes an agent on each box and ...
0
votes
1
answer
192
views
Script to cleanup Windows.old remotely
Problem:
A lot of older workstations on our networks are running out of hard disk space and I am looking for ways to stream-line the process of cleaning up some space. I understand I can use Disk ...
2
votes
0
answers
34
views
Disable computer on a schedule
I'm looking for a way to disable end user access to a Windows 10 workstation during a given period, say, from 8pm to 8am.
It doesn't need to be superuser-proof.
It doesn't need to be reboot-proof.
...
1
vote
2
answers
1k
views
winget not working unless I do
When I open Powershell, and type winget - this is the response:
winget : The term 'winget' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of ...
0
votes
2
answers
3k
views
Is it possible to check a client Windows PC's registry to see if it is joined to an Azure AD domain?
On a Windows PC joined to a 'traditional' Active Directory domain, querying Win32_ComputerSystem or Win32_NTDomain returns the domain name.
It seems that if it's Azure anything [joined], those classes ...
0
votes
1
answer
3k
views
PowerShell - List WSUS Updates Needed for Each Client
I need to provide a monthly report to our client listing the updates needed by each Windows server in our environment. Ideally, the report would list the updates for the month and the servers in my ...
1
vote
2
answers
784
views
Windows Equivalent to `sha256sum -c` (cryptographic hash, digest file, recursive integrity check, SHA256SUMS)
What is the equivalent to sha256sum -c in Windows?
I have a set of very important files that I need to copy-to and mirror across many different types of disks in many geographically distinct locations....
0
votes
1
answer
5k
views
How can I set the 'The other domain supports Kerberos AES Encryption' setting programmatically?
In the GUI (Active Directory Domains and Trusts MMC Snap-in (domain.msc)), you can set the "The other domain supports Kerberos AES Encryption" setting for a trust relationship:
I am looking ...
0
votes
1
answer
2k
views
CMD - Check if exist firewall rule, and add if not
I need some help to make an script that check if exist a rule, and add if not.
It auto add all exe inside a folder where i run it.
@echo off
cls
Echo.--------------------------------------------------...
-1
votes
1
answer
3k
views
Handle exception with long paths in Powershell
I am new here and I facing issues with my powershell script whith long paths.
This script aims to get relative path and hash from files/folders and its subfolders. It works with some with others I get ...
1
vote
1
answer
112
views
weird behaviour in a Windows 2019 .BAT script
I have to restore a backup from a Linux MariaDB to a Windows MariaDB, where the PowerBI gateway will import its data. "mariabackup" is MariaDB's physical backup tool. But to restore it, the ...
0
votes
0
answers
106
views
How to merge two data sources with slightly different folder names
How can I copy all .msg files that are spread throughout some GUID sub-folders in one folder to another folder that has a slightly different folder name at the end. Is it possible?
So for example:
...
-1
votes
1
answer
2k
views
Programatically get full path to binary in powershell (which, where, Get-Command)
How do I get the absolute path to a given binary and store it to a variable?
What is the equivalent to the following for Linux Bash in Windows Powershell?
user@disp985:~$ path=`which gpg`
user@disp985:...
0
votes
1
answer
3k
views
How to select using script on Task Scheduler the "run with highest privileges"
Hi I'm doing some scripting to add a task on a Task Scheduler. However I need to have a script to select the "run with highest privileges".
Sample code:
Dim settings
Set settings = ...
1
vote
0
answers
2k
views
Powershell Script setting WMI CIMV2 Permissions
I am currently trying do change up a script so that I can put it into a GPO. The Script itself works but I want to do a "if else" around it.
The Script is found here: https://gist.github.com/...
1
vote
2
answers
25k
views
Script not running on startup for GPO
I have seen many posts on this website about something similar but none of them have had the resources to fix my issue so I will go into as much detail as I can. If I leave any information out let me ...
-1
votes
3
answers
5k
views
Adobe Reader DC automated install using PowerShell
I wanted to automate the installation of Adobe Reader DC using an existing executable file (AcroRdrDC1501020060_en_US.exe) present in my local computer with a PowerShell script in non-interactive ...
0
votes
1
answer
3k
views
convert strings from mixed to upper case in windows batch scripting
Is there a way to convert strings from mixed to upper case in windows batch scripting?
I am writing a batch file to create certain objects and grant user groups access to them. That is, I should issue ...
-2
votes
1
answer
634
views
Passing a list as parameter in a call within a windows bat file
For a set of project, I need to automate granting access to users and would write a *.bat
I would write something like this (but more complex):
@echo off
CALL :grant "user1 user2" "read ...
0
votes
1
answer
59
views
Script without put ran as administrator leaves no file [closed]
I am trying to run this script as administrator. When I run it without admin rights the log file is save in C:\Windows\System32. I put echo %~dp0 in the script and it echos to the current directory.
%~...
1
vote
0
answers
2k
views
PowerShell Script to create a VPN connection for all users
I have the following PowerShell script that creates a VPN connection and a desktop shortcut to Rasphone.
#
# Powershell script to create a client VPN connection to a Meraki MX.
#
# Configuration ...
0
votes
0
answers
2k
views
Correct way to run scripts in automated, unattended Windows installation
I have some custom scripts that I have written to customise Windows 10 such as removing bloatware and setting file explorer options via Registry Editor that I use to apply to all users and/or the ...
0
votes
3
answers
4k
views
Invoke-RestMethod returns 400 error no matter what I do
So I'm working on a helpdesk automation with the Samanage API and need to update the "state" of the ticket. I've read the documentation and there is nothing i saw for updating the ticket ...
0
votes
2
answers
8k
views
PowerShell script to report free disk space on servers
I am required to get reports about free disk space on our exchange servers.
I found this link : https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Script-Sample-f7164554
But I am unable to ...
1
vote
2
answers
11k
views
PowerShell script error: the RPC server is unavailable
Im slowly getting my feet wet with Powershell, so I am a new beginner. Trying to have PS pull from a text file a list of PCs and let me know the status of their App Identity Service. The basic ...
0
votes
1
answer
732
views
Using PsInfo with a Timeout Procedure (or piping through PsExec?)
We have a problem with people in our company leaving their computer running 24/7 even over weekends. Our corporate policy is to shut down when not in use but that doesn't always happen. So what we ...
-1
votes
1
answer
214
views
How can I recursively unarchive all files that are bzipped2?
I have a folder. In this folder I have a lot of other folders. In folders I have bzip files and non-bzip. How to unarchieve all bzip2 files in same directory where they are ?
2
votes
2
answers
5k
views
Change Registry Key Permissions Access Control List using only Command Prompt
I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into ...
2
votes
1
answer
681
views
Faster way to add IP scopes to Item Level Targeting?
I have a GPO with printers mapped via the user preferences. Each printer needs to be item-level targeted only to computers in a specific IP range. I have a list of about 92 ranges that need to be ...
2
votes
2
answers
3k
views
Net.HttpWebRequest difference between Powershell and PowerShell Core
Hoping someone can shed light on this. In Powershell, the following code generates output of the website certificate:
$req = [Net.HttpWebRequest]::Create('https://www.google.com')
$req.GetResponse()
$...
0
votes
0
answers
261
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
144
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 ...
4
votes
1
answer
1k
views
Do group policy shutdown scripts run before Windows Services shut down?
You can have a [shutdown] section in group policy which specifies some scripts to run during system shutdown. Do all these scripts run before Windows services start receiving 'Preshutdown' ...
1
vote
0
answers
84
views
ideas needed - cut the smb connection when disk full
Hello sometimes we are having issues like when some misbehaving user copies files to a server via admin share or other share and he causes disk drive to fill and a p1 ticket be created by monitoring. ...
0
votes
1
answer
2k
views
Appending deployment.properties to enable TLS
I need to be able to append everyone's deployment.properties file to add additional lines to enable all versions of TLS. Big enterprise uses multiple different versions of Java and also multiple ...
-2
votes
2
answers
2k
views
Check existence of multiple network shared files
Let's say I have a list of files (files.txt), which looks like:
\\myshare\file1
\\myshare\file2
\\myshare\file3
How is it possible to check via a batch script (windows) to check if those files exist ...
1
vote
0
answers
938
views
Set-Acl : Attempted to perform an unauthorized operation while using Addaudit Rule
I am trying to run Powershell script to set Audit Rule on C:\Windows\security folder on my Windows 2008 box.
Below is the script:
$FileDirList = ("C:\Windows\security")
$AccountName = New-Object ...
3
votes
2
answers
2k
views
How to check that mstsc.exe has successfully set up a RDP connection?
We use mstsc.exe to establish RDP connections to other servers in batch files, which are then terminated after some tasks have been run. This basically works fine, but every now and then it takes ...
9
votes
1
answer
10k
views
Windows - turn off high contrast mode via GPO or script?
I have a situation with a sizable deployment of Windows 10 computers and users who are turning on some truly horrific high-contrast themes, and then consuming IT resources because they can't change it ...
0
votes
1
answer
358
views
Powershell script - check exit code
Hi I have the following script:
foreach ($server in $ProductList.$SelectedServer){
Invoke-Command -ComputerName $server -Credential domain\user -ScriptBlock {
Import-Module WebAdministration
echo "...
1
vote
1
answer
263
views
PowerShell Script works in Windows 10 but not on Windows Embedded Standart
I have the following script work in windows 10 but not on windows 7:
$LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss"
$Path1= "TEST\TESTLog_$(get-date -f yyyy-MM-dd).txt"
$AffPBS= Get-Process "...
1
vote
0
answers
142
views
Windows Firewall - Unblocking via Script
I'm trying to setup a script to unblock IP's that may get caught up in a custom rule on Windows Firewall. I am trying this:
netsh advfirewall firewall delete rule name="rule_name" remoteip="ip"
In ...
1
vote
2
answers
9k
views
Powershell - Split Array Value keep first element
I'm trying to extract just the IPs from a filtered JSON using the following code:
$curl = Invoke-WebRequest -Method Get -Uri "http://urltojson.com/file.json"
$curl2 = $curl.Content.replace(&...
2
votes
1
answer
407
views
Truncating part of an LDAP DN in Powershell? (Or getting the OU from an LDAP DN.)
What's the easiest way to get the OU containing an LDAP object in PowerShell?
I'm working on a script to manage some groups that I've made "dynamic" with a script, and I can get the full ...
0
votes
1
answer
4k
views
Powershell - add to array without echoing index
I'm adding items to an array called $MissingIps using the following command
$MissingIps = @("")
[System.Collections.ArrayList]$ExistingIps = $MissingIps
if ($lbips -notcontains $awsip){
...
3
votes
2
answers
3k
views
List users recursively in large organization AD
I have a script that recursively lists group members. The issue is that there are over 5K so I cannot use Get-ADGroupMember, and I also need to only get enabled users. UAC, despite microsoft ...
1
vote
2
answers
83
views
Protocolling Windows-Logins with logParser
I would like to protocoll all windows logins with logparser.
Everything works fine for Application or System but not in Security.
The script looks like this:
"C:\Program Files (x86)\Log Parser 2.2"\...
0
votes
1
answer
124
views
DOS Set variable only available after execution
I have a very simple script that I want to take a value from a text document (single line, one value) and pass it to taskkill - it needs to be a one liner too so I have:
set /p pidtokill=<C:\temp\...
0
votes
1
answer
1k
views
how to reset original owner after assigning permissions to Windows specific folders using ICACLS and takeown?
For a specific requirement i need to assign permissions to "Starks" for C: and C:\Windows C:\Windows\System32 and few other windows specific folders on a Win7 machine without tampering existing ...
1
vote
0
answers
2k
views
Powershell script run System.IO.FileSystemWatcher as Windows service
I need a FileWatcher script to detect new files and execute another powershell script if the files are found. The destination directory of this 2nd PS script outputs file to a UNC mount that has the ...