windows-scripting

Getting a Windows command prompt contents to a text file

我是研究僧i 提交于 2021-02-11 12:23:20
问题 I want to write a batch utility to copy the output of a command prompt window to a file. I run my command prompt windows with the maximum depth of 9999 lines, and occasionally I want to grab the output of a command whose output is off-screen. I can do this manually with the keys Ctrl-A , Ctrl-C and then pasting the result into Notepad - I just want to automate it in a batch file with a call to: SaveScreen <text file name> I know I can do it with redirection, but that would involve knowing

Add DOMAIN\Domain Admins group as Full Access to the orphaned Home Directory?

二次信任 提交于 2020-07-08 00:36:09
问题 The below script was created by the great https://stackoverflow.com/users/9898643/theo to list all orphaned HomeDirectory: $ServerHomeDirShare = "\\FileServer\HomeDir$" $filter = "(Enabled -eq 'true')" # get all user accounts from AD; only SamAccountName required $users = Get-ADUser -Filter $filter | Select-Object -ExpandProperty SamAccountName Get-ChildItem -Path $ServerHomeDirShare -Directory | Where-Object { $users -notcontains ($_.Name -replace '^(\w+\.\w+).*', '$1') } | Select-Object

Add DOMAIN\Domain Admins group as Full Access to the orphaned Home Directory?

妖精的绣舞 提交于 2020-07-08 00:35:15
问题 The below script was created by the great https://stackoverflow.com/users/9898643/theo to list all orphaned HomeDirectory: $ServerHomeDirShare = "\\FileServer\HomeDir$" $filter = "(Enabled -eq 'true')" # get all user accounts from AD; only SamAccountName required $users = Get-ADUser -Filter $filter | Select-Object -ExpandProperty SamAccountName Get-ChildItem -Path $ServerHomeDirShare -Directory | Where-Object { $users -notcontains ($_.Name -replace '^(\w+\.\w+).*', '$1') } | Select-Object

Insert a new line in a pop up message box created by CreateObject(“WScript.Shell”)

点点圈 提交于 2020-05-17 05:49:46
问题 Sorry but I was trying to find the answer for hours but could not figure it out. I tried playing with vbNewLine and vbCrLf but could not make it to work in the function and in the function call. How do I add a new line with the code below? Tried this but it did not work: checker = MessageTimeOut("Underlying raw data in the workbook has been updated." & vbNewLine & "This will close automatically.", "UPDATE RAW DATA - COMPLETED", 5) Also tried: checker = MessageTimeOut("Underlying raw data in

Windows cmd simulate console input a command

删除回忆录丶 提交于 2020-02-06 07:56:16
问题 I need to write a batch script which connects to a vpn automatically when username and password is saved somewhere (Ex: in a file). VPN client is openconnect which provides a CLI but the problem is user input needs to be provided interactively to the command in order for it to complete. See the output below when I run : openconnect <serverhostname> OUTPUT POST https://<serverhostname>/ Connected to <serverhostname>:443 SSL negotiation with <serverhostname> Server certificate verify failed:

How to get the size of a HTA window?

♀尐吖头ヾ 提交于 2020-01-15 07:34:53
问题 You can SET the size of a HTA window but I can't find a way to GET its size. All I can think of is reading document.body.offsetWidth and .offsetHeight , but those give you the viewport size not the actual window size. Is it possible to know that? 回答1: It seems there are no properties or methods to get that information. The now beta-released IE9 has the new properties outterWidth and outterHeight , but that is not an option for now. So I devised a workaround for this: function

.vbs Help me loop this through a directory

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 19:55:17
问题 I have written a script that works. What it does now is it looks through a directory to a given file and returns what is on the second row fourth tab (RXC193) and renames the file to that of which it found from a file like this: @Program @RxBIN @RXPCN @RxGroup @MemberID @WebsiteE @WebsiteS @VerticalLogo @TextLogo RXCUT 013824 RXCUT RXC193 RXC5FHXF9 www.rxcut.com/HBG www.rxcut.com/HBG/es P:\RxCut\In Design Implementation\RXC193 What I need this script to be able to do is loop through the

.vbs Help me loop this through a directory

為{幸葍}努か 提交于 2020-01-06 19:55:13
问题 I have written a script that works. What it does now is it looks through a directory to a given file and returns what is on the second row fourth tab (RXC193) and renames the file to that of which it found from a file like this: @Program @RxBIN @RXPCN @RxGroup @MemberID @WebsiteE @WebsiteS @VerticalLogo @TextLogo RXCUT 013824 RXCUT RXC193 RXC5FHXF9 www.rxcut.com/HBG www.rxcut.com/HBG/es P:\RxCut\In Design Implementation\RXC193 What I need this script to be able to do is loop through the

Batch - syntax error when trying to echo greater-then sign (>)

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 06:05:35
问题 I have the following stript: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION SET /A countArgs=1 ... SET /A countArgs+=1 CALL :error "!countArgs!. Argument ^-^> bla" EXIT /B 1 ... :error ECHO ERROR ECHO %~1 EXIT /B 0 But the 2. ECHO -line in the :error routine echo s nothing. When I reduce the CALL argument string to "!countArgs!. Argument ^-^>" i get a syntax error and when i reduce it to "!countArgs!. Argument ^-" or even "!countArgs!. Argument -" it works properly. According to

Modifying PowerShell to display phone number in International format without changing the AD Attributes?

只愿长相守 提交于 2020-01-06 06:01:33
问题 I need to modify the below code with some International Phone area code formatting from the Active Directory without modifying the actual AD attribute value: $defaultTelephone = '1800 552 001' #Get Active Directory information for the currently logged on user $sysInfo = New-Object -ComObject 'ADSystemInfo' $userDN = $sysInfo.GetType().InvokeMember('UserName', 'GetProperty', $null, $sysInfo, $null) $adUser = [ADSI]"LDAP://$($userDN)" [void][Runtime.InteropServices.Marshal]: