powershell

Activate IIS site logging field [PowerShell]

↘锁芯ラ 提交于 2021-02-08 09:53:53
问题 Is there a way to activate logging fields on a specific website in IIS, preferably through PowerShell? I want to activate the 'Client IP Address' logging field without needing to RDP to the machine and setting it manually. I am running Windows Server 2012 with IIS 8.5 回答1: You can also set the flags by using the following methodology whereby you use the total value of the flags required to by set as per the list below. The values are set by 2 to the power of the flag number. Total up all the

Activate IIS site logging field [PowerShell]

隐身守侯 提交于 2021-02-08 09:53:38
问题 Is there a way to activate logging fields on a specific website in IIS, preferably through PowerShell? I want to activate the 'Client IP Address' logging field without needing to RDP to the machine and setting it manually. I am running Windows Server 2012 with IIS 8.5 回答1: You can also set the flags by using the following methodology whereby you use the total value of the flags required to by set as per the list below. The values are set by 2 to the power of the flag number. Total up all the

Using powershell to count number of files in subfolder with specific name

夙愿已清 提交于 2021-02-08 09:47:07
问题 So I've started working on a problem where I need to know how many files are in a subfolder of a certain name, that is repeated multiple times in throughout the directory. All folders I want to count have the same name. For example: Main Folder Subfolder Folder I want to count Folder A Folder B Subfolder Folder I want to count Folder C Folder D I'm able to count the number of files in all subfolders recursively, but I don't know how to only look at folders named " Folder I want to count ".

Create a popup message in Powershell

久未见 提交于 2021-02-08 09:46:24
问题 I'm attempting to make a function that will allow me to popup a please wait message run some more script then close the popup Function Popup-Message { param ([switch]$show,[switch]$close) Add-Type -AssemblyName System.Windows.Forms # Build Form $objForm = New-Object System.Windows.Forms.Form $objForm.Text = "Test" $objForm.Size = New-Object System.Drawing.Size(220,100) # Add Label $objLabel = New-Object System.Windows.Forms.Label $objLabel.Location = New-Object System.Drawing.Size(80,20)

Execute PS from bat for Intune Win32

痴心易碎 提交于 2021-02-08 09:36:12
问题 I am so confused and actually also not so familiar with PS and bat after my troubles with them. I want to set the Lockscreen in Windows 10 with Intune through an IntuneWin file (WIN32 application). I have a folder with the image, which I want to set, a copy.bat which should copy the image in the directory and also execute the PS file for setting the login image and a del.bat for deleting the image. copy.bat md %AllUsersProfile%\sz copy /Y Wallpaper.jpg %AllUsersProfile%\sz powershell

Passing Python JSON argument with whitespace

烈酒焚心 提交于 2021-02-08 09:32:42
问题 I am trying to pass JSON as an argument to python script in command prompt. It works if the element in JSON does not have white spaces in value but it does not work if there are white spaces. Here is script import json, sys, traceback if(len(sys.argv)>1): print(sys.argv[1]) jsonInput = json.loads(sys.argv[1]); print(jsonInput['name']) print(jsonInput['kingdom']) print(jsonInput['slogan']) Passing below JSON as an argument in the power Shell. I have spaces in values e.g. Jon Snow python C:

Extending accelerated .Net class using the original constructors

為{幸葍}努か 提交于 2021-02-08 09:32:06
问题 Inspired by theses questions: Get a specific octet from the string representation of an IPv4 address Powershell - Checking IP Address range based on CSV file I am trying to extend the IPAddress class with an ToBigInt() method in PowerShell (if even possible) to be able to easily compare (IPv4 and IPv6) addresses using comparison operations along with -lt and -gt . E.g.: ([IPAddress]'2001:db8::8a2e:370:7334').ToBigInt() -lt ([IPAddress]'2001:db8::8a2e:370:7335').ToBigInt() My first attempt:

Extending accelerated .Net class using the original constructors

那年仲夏 提交于 2021-02-08 09:31:13
问题 Inspired by theses questions: Get a specific octet from the string representation of an IPv4 address Powershell - Checking IP Address range based on CSV file I am trying to extend the IPAddress class with an ToBigInt() method in PowerShell (if even possible) to be able to easily compare (IPv4 and IPv6) addresses using comparison operations along with -lt and -gt . E.g.: ([IPAddress]'2001:db8::8a2e:370:7334').ToBigInt() -lt ([IPAddress]'2001:db8::8a2e:370:7335').ToBigInt() My first attempt:

Powershell: Piping output of pracl command to array

本小妞迷上赌 提交于 2021-02-08 09:29:25
问题 pracl is a sysinternal command that can be used to list the ACLs of a directory. I have a list of shares and I want to create a csv file such that for each ACL entry, I want the share path in one column and share permission in the next. I was trying to do that by using the following code $inputfile = "share.txt" $outputFile = "out.csv" foreach( $path in Get-Content $inputfile) { $results=.\pracl.exe $path { foreach ($result in $results) {write-host $path,$line} } $objResult = [pscustomobject]

Passing Powershell variable to Windows Batch file

五迷三道 提交于 2021-02-08 09:16:30
问题 Due to restrictions around my project and how this is being deployed, I need to run a powershell command in a batch file and echo a variable from the powershell script. This scripts retrieves a model number from a TV over RS-232 and returns the model in HEX. I wrote the script and meticulously condensed it to one line that runs. I can even 'powershell -command "[myCondensedScript]"' in the command line and it works great for /F %%a in ('powershell.exe -command "$port = New-Object System.IO