PS> net use z: \\127.0.0.1\c$ The command completed successfully.
PS> net use z: /delete z: was deleted successfully.
PS> net use z: /delete net : The network connection could not be found. At line:1 char:1 + net use z: /delete + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (The network con...d not be found.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError
More help is available by typing NET HELPMSG 2250.
Name Used (GB) Free (GB) Provider Root CurrentLocation ------------------------------------------------- Z 11076,550,00 FileSystem \\192.168.2.107\docs
# return result is an array PS> $info-is [Array] True
# array elements can only be accessed via numeric index PS> $info.Count 64
# the number of returned properties depends on the printer model # the index of given properties may change so accessing a property by # index works but can be unreliable: PS> $info[0]
ComputerName PrinterName PropertyName Type Value -------------------------------------------- S/W Laser HP Config:AccessoryO... String 500Stapler
# the actual property value is stored in the property “Value” PS> $info[0].Value 500Stapler
# using comparison operators, you can convert string content to Boolean # for example to check whether a printer has a certain feature installed PS> $info[2]
ComputerName PrinterName PropertyName Type Value -------------------------------------------- S/W Laser HP Config:AutoConfig... String NotInstalled
ComputerName PrinterName PropertyName Type Value -------------------------------------------- S/W Laser HP Config:AccessoryO... String 500Stapler S/W Laser HP Config:BookletMak... String NOTINSTALLED
# launch LNK file as Administrator # THIS PATH MUST EXIST (use previous script to create the LNK file or create one manually) $path = [Environment]::GetFolderPath('Desktop') | Join-Path-ChildPath'myLink.lnk' # read LNK file as bytes... $bytes = [System.IO.File]::ReadAllBytes($path) # flip a bit in byte 21 (0x15) $bytes[0x15] = $bytes[0x15] -bor0x20 # update the bytes [System.IO.File]::WriteAllBytes($path, $bytes)